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

Unified Diff: src/pipe/SkGPipeRead.cpp

Issue 613673005: Override SkCanvas::drawImage() in SkDeferredCanvas and SkGPipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase master, depends on other cl for tests Created 6 years, 3 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/pipe/SkGPipeRead.cpp
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 8cb0e34d0a5d9c844ffa638b4ef081906d76a52d..ddfc2ae687f5edddb261390c57ccb9c106a91654 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -408,11 +408,11 @@ static void drawDRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
static void drawPatch_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
-
+
unsigned flags = DrawOp_unpackFlags(op32);
-
+
const SkPoint* cubics = skip<SkPoint>(reader, SkPatchUtils::kNumCtrlPts);
-
+
const SkColor* colors = NULL;
if (flags & kDrawVertices_HasColors_DrawOpFlag) {
colors = skip<SkColor>(reader, SkPatchUtils::kNumCorners);
@@ -651,6 +651,37 @@ static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
}
}
+static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
+ SkGPipeState* state) {
+ bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag);
+ SkAutoTUnref<const SkImage> image (static_cast<const SkImage*>(reader->readPtr()));
reed1 2014/10/01 14:12:39 // Balances call to ref() in SkGPipeWrite
Rémi Piotaix 2014/10/01 19:29:58 Done.
+ SkScalar left = reader->readScalar();
+ SkScalar top = reader->readScalar();
+
+ if (state->shouldDraw()) {
+ canvas->drawImage(image, left, top, hasPaint ? &state->paint() : NULL);
+ }
+}
+
+static void drawImageRect_rp(SkCanvas* canvas, SkReader32* reader,
+ uint32_t op32, SkGPipeState* state) {
+ unsigned flags = DrawOp_unpackFlags(op32);
+ bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag);
+ bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag);
+ SkAutoTUnref<const SkImage> image (static_cast<const SkImage*>(reader->readPtr()));
reed1 2014/10/01 14:12:39 // Balances call to ref() in SkGPipeWrite
Rémi Piotaix 2014/10/01 19:29:58 Done.
+
+ const SkRect* src;
+ if (hasSrc) {
+ src = skip<SkRect>(reader);
+ } else {
+ src = NULL;
+ }
+ const SkRect* dst = skip<SkRect>(reader);
+ if (state->shouldDraw()) {
+ canvas->drawImageRect(image, src, *dst, hasPaint ? &state->paint() : NULL);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
static void drawData_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
@@ -831,6 +862,8 @@ static const ReadProc gReadTable[] = {
drawClear_rp,
drawData_rp,
drawDRRect_rp,
+ drawImage_rp,
+ drawImageRect_rp,
drawOval_rp,
drawPaint_rp,
drawPatch_rp,
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | src/pipe/SkGPipeWrite.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698