| /* |
| * Copyright 2026 Google LLC |
| * |
| * Use of this source code is governed by a BSD-style license that can be |
| * found in the LICENSE file. |
| */ |
| |
| #include "rust/exif/FFI.h" |
| #include "rust/exif/FFI.rs.h" // Generated by CXX bridge. |
| |
| #include "include/private/SkExif.h" |
| // SkExif.h transitively includes SkEncodedOrigin.h for kLast_SkEncodedOrigin. |
| |
| namespace rust_exif { |
| |
| void ToSkExifMetadata(const ExifMetadata& rust_meta, SkExif::Metadata* out) { |
| // Orientation: cast u32 (1-8) to SkEncodedOrigin after range check. |
| if (rust_meta.has_origin) { |
| uint32_t v = rust_meta.origin; |
| if (v >= 1 && v <= static_cast<uint32_t>(kLast_SkEncodedOrigin)) { |
| out->fOrigin = static_cast<SkEncodedOrigin>(v); |
| } |
| } |
| |
| if (rust_meta.has_hdr_headroom) { |
| out->fHdrHeadroom = rust_meta.hdr_headroom; |
| } |
| |
| if (rust_meta.has_resolution_unit) { |
| out->fResolutionUnit = rust_meta.resolution_unit; |
| } |
| |
| if (rust_meta.has_x_resolution) { |
| out->fXResolution = rust_meta.x_resolution; |
| } |
| |
| if (rust_meta.has_y_resolution) { |
| out->fYResolution = rust_meta.y_resolution; |
| } |
| |
| if (rust_meta.has_pixel_x_dimension) { |
| out->fPixelXDimension = rust_meta.pixel_x_dimension; |
| } |
| |
| if (rust_meta.has_pixel_y_dimension) { |
| out->fPixelYDimension = rust_meta.pixel_y_dimension; |
| } |
| } |
| |
| } // namespace rust_exif |