Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: src/utils/SkBitmapRegionCanvas.h

Issue 1288963002: Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use nullptr instead of NULL Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+
+};

Powered by Google App Engine
This is Rietveld 408576698