Index: src/utils/SkBitmapRegionCanvas.h |
diff --git a/src/utils/SkBitmapRegionCanvas.h b/src/utils/SkBitmapRegionCanvas.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1cd3d170bfbd9222c15b4ce2fe8395073f9f642a |
--- /dev/null |
+++ b/src/utils/SkBitmapRegionCanvas.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 "SkScanlineDecoder.h" |
+ |
+/* |
+ * This class implements SkBitmapRegionDecoder by drawing to an SkCanvas. |
scroggo
2015/09/01 22:05:28
I'm not sure this captures what is interesting abo
msarett
2015/09/02 18:02:23
It also does some subsetting. Since we can only d
|
+ */ |
+class SkBitmapRegionCanvas : public SkBitmapRegionDecoder { |
+public: |
+ |
+ /* |
+ * Takes ownership of pointer to decoder |
+ */ |
+ SkBitmapRegionCanvas(SkScanlineDecoder* decoder); |
+ |
+ /* |
+ * This has several key differences from the Android version: |
+ * Returns a Skia bitmap instead of an Android bitmap. |
+ * Android version attempts to reuse a recycled bitmap. |
+ */ |
+ SkBitmap* decodeRegion(int start_x, int start_y, int width, int height, |
+ int sampleSize, SkColorType prefColorType) override; |
+ |
+private: |
+ |
+ SkAutoTDelete<SkScanlineDecoder> fDecoder; |
+ |
+ typedef SkBitmapRegionDecoder INHERITED; |
+ |
+}; |