aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/android/SkBitmapRegionCodec.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-11-13 06:11:09 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-13 06:11:09 -0800
commit506e19a4c8395178e8da81576b3c37616593e560 (patch)
tree0877d660a91ef6322059269e7020988459e91ded /src/android/SkBitmapRegionCodec.h
parent9c8605144a0f15e3e69a4e1dcd5d3e63f339380e (diff)
Move SkBitmapRegionDecoder to include/android and src/android
This will expose the BitmapRegionDecoder API as a public include and move the implementation to src. This makes this code more naturally exposed in Android and easier to test in DM and nanobench. BUG=skia: Review URL: https://codereview.chromium.org/1438873002
Diffstat (limited to 'src/android/SkBitmapRegionCodec.h')
-rw-r--r--src/android/SkBitmapRegionCodec.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/android/SkBitmapRegionCodec.h b/src/android/SkBitmapRegionCodec.h
new file mode 100644
index 0000000000..79774173b0
--- /dev/null
+++ b/src/android/SkBitmapRegionCodec.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+#include "SkBitmapRegionDecoder.h"
+#include "SkAndroidCodec.h"
+
+/*
+ * This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
+ */
+class SkBitmapRegionCodec : public SkBitmapRegionDecoder {
+public:
+
+ /*
+ * Takes ownership of pointer to codec
+ */
+ SkBitmapRegionCodec(SkAndroidCodec* codec);
+
+ bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator,
+ const SkIRect& desiredSubset, int sampleSize,
+ SkColorType colorType, bool requireUnpremul) override;
+
+ bool conversionSupported(SkColorType colorType) override;
+
+ SkEncodedFormat getEncodedFormat() override { return fCodec->getEncodedFormat(); }
+
+private:
+
+ SkAutoTDelete<SkAndroidCodec> fCodec;
+
+ typedef SkBitmapRegionDecoder INHERITED;
+
+};