/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef BitmapRegionDecoder_DEFINED #define BitmapRegionDecoder_DEFINED #include "client_utils/android/BRDAllocator.h" #include "include/codec/SkAndroidCodec.h" #include "include/core/SkBitmap.h" #include "include/core/SkData.h" namespace android { namespace skia { class BitmapRegionDecoder final { public: static std::unique_ptr Make(sk_sp data); bool decodeRegion(SkBitmap* bitmap, BRDAllocator* allocator, const SkIRect& desiredSubset, int sampleSize, SkColorType colorType, bool requireUnpremul, sk_sp prefColorSpace); SkEncodedImageFormat getEncodedFormat() { return fCodec->getEncodedFormat(); } SkColorType computeOutputColorType(SkColorType requestedColorType) { return fCodec->computeOutputColorType(requestedColorType); } sk_sp computeOutputColorSpace(SkColorType outputColorType, sk_sp prefColorSpace = nullptr) { return fCodec->computeOutputColorSpace(outputColorType, prefColorSpace); } int width() const; int height() const; private: BitmapRegionDecoder(std::unique_ptr codec); std::unique_ptr fCodec; }; } // namespace skia } // namespace android #endif // BitmapRegionDecoder_DEFINED