/* * Copyright 2025 Google LLC. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "experimental/rust_bmp/decoder/SkBmpRustDecoder.h" #include #include "experimental/rust_bmp/ffi/FFI.rs.h" #include "experimental/rust_bmp/decoder/impl/SkBmpRustCodec.h" #include "include/core/SkData.h" #include "include/core/SkStream.h" #include "src/core/SkStreamPriv.h" namespace SkBmpRustDecoder { bool IsBmp(const void* buff, size_t bytesRead) { const rust::Slice data_slice{ static_cast(buff), bytesRead }; return rust_bmp::is_bmp_data(data_slice); } std::unique_ptr Decode(std::unique_ptr stream, SkCodec::Result* result, SkCodecs::DecodeContext) { return SkBmpRustCodec::MakeFromStream(std::move(stream), result); } std::unique_ptr Decode(sk_sp data, SkCodec::Result* result, SkCodecs::DecodeContext) { return Decode(SkMemoryStream::Make(std::move(data)), result); } } // namespace SkBmpRustDecoder