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

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: 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..113ab985a8858e1777ff6e1440d288203a6731ed
--- /dev/null
+++ b/src/utils/SkBitmapRegionCanvas.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
scroggo 2015/08/13 16:53:07 This is the wrong header. If this is new code in S
msarett 2015/08/13 18:10:23 You're right. BitmapRegionSampler needs the Andro
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SkBitmap.h"
+#include "SkBitmapRegionDecoder.h"
+#include "SkScanlineDecoder.h"
+
+/*
+ * This class implements SkBitmapRegionDecoder using SkCanvas.
scroggo 2015/08/13 16:53:07 by drawing to an SkCanvas?
msarett 2015/08/13 18:10:23 Done.
+ */
+class SkBitmapRegionCanvas : public SkBitmapRegionDecoder {
+public:
+
+ /*
+ * This has several key differences from the Android version:
scroggo 2015/08/13 16:53:07 I think it's probably good to contrast with the an
msarett 2015/08/13 18:10:23 Added comments on the parameters to the base class
+ * 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,
scroggo 2015/08/13 16:53:07 Out of curiosity, why does this return a pointer t
msarett 2015/08/13 18:10:23 The reason this returns an SkBitmap* is that I was
+ int sampleSize, SkColorType prefColorType) override;
+
+ SkBitmapRegionCanvas(SkScanlineDecoder* decoder);
scroggo 2015/08/13 16:53:07 nit: We usually put constructors first, I believe
msarett 2015/08/13 18:10:23 Done.
+
+ ~SkBitmapRegionCanvas() {}
scroggo 2015/08/13 16:53:07 Is this necessary? I think the compiler will gener
msarett 2015/08/13 18:10:23 Done.
+
+private:
+
+ SkAutoTDelete<SkScanlineDecoder> fDecoder;
+
+ typedef SkBitmapRegionDecoder INHERITED;
+
+};

Powered by Google App Engine
This is Rietveld 408576698