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 #ifndef SkAndroidCodecAdapter_DEFINED 8 #define SkAndroidCodecAdapter_DEFINED 9 10 #include "SkAndroidCodec.h" 11 12 /** 13 * This class wraps SkCodec to implement the functionality of SkAndroidCodec. 14 * The underlying SkCodec implements sampled decodes. SkCodec's that do not 15 * implement that are wrapped with SkSampledCodec instead. 16 */ 17 class SkAndroidCodecAdapter : public SkAndroidCodec { 18 public: 19 20 explicit SkAndroidCodecAdapter(SkCodec*, ExifOrientationBehavior); 21 22 ~SkAndroidCodecAdapter() override {} 23 24 protected: 25 26 SkISize onGetSampledDimensions(int sampleSize) const override; 27 28 bool onGetSupportedSubset(SkIRect* desiredSubset) const override; 29 30 SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, 31 const AndroidOptions& options) override; 32 33 private: 34 35 typedef SkAndroidCodec INHERITED; 36 }; 37 #endif // SkAndroidCodecAdapter_DEFINED 38