aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/android/SkBitmapRegionCodec.h
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-11-10 15:49:46 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-10 15:49:46 -0800
commit84a80652752976c9abe42d28e467c362baff3e39 (patch)
treee938caf2ab699f1d8423c3a893fc6e57472513a0 /tools/android/SkBitmapRegionCodec.h
parent5c351f38fa365b03326454ad3e2ecc5dfb8184fc (diff)
Reorganize BRD code in new tools directory
Rename SkCodecTools.h to SkBitmapRegionDecoderPriv.h Move BRD code to its own directory in tools. This allows us to not need to expose the entire tools directory in Android. BUG=skia: Review URL: https://codereview.chromium.org/1417393004
Diffstat (limited to 'tools/android/SkBitmapRegionCodec.h')
-rw-r--r--tools/android/SkBitmapRegionCodec.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/android/SkBitmapRegionCodec.h b/tools/android/SkBitmapRegionCodec.h
new file mode 100644
index 0000000000..1739a04378
--- /dev/null
+++ b/tools/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, SkBitmap::Allocator* 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;
+
+};