SkBitmapRegionCodec.h revision 248ff02331d7f73ee4b6c5a7eabeae1080c16cd4
1/* 2 * Copyright 2015 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8#include "SkBitmap.h" 9#include "SkBitmapRegionDecoder.h" 10#include "SkAndroidCodec.h" 11 12/* 13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec. 14 */ 15class SkBitmapRegionCodec : public SkBitmapRegionDecoder { 16public: 17 18 /* 19 * Takes ownership of pointer to codec 20 */ 21 SkBitmapRegionCodec(SkAndroidCodec* codec); 22 23 bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator, 24 const SkIRect& desiredSubset, int sampleSize, 25 SkColorType colorType, bool requireUnpremul) override; 26 27 bool conversionSupported(SkColorType colorType) override; 28 29 SkEncodedFormat getEncodedFormat() override { 30 return (SkEncodedFormat)fCodec->getEncodedFormat(); 31 } 32 33private: 34 35 std::unique_ptr<SkAndroidCodec> fCodec; 36 37 typedef SkBitmapRegionDecoder INHERITED; 38 39}; 40