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

Unified Diff: src/gpu/GrRecordReplaceDraw.cpp

Issue 551843002: Fix two SkRecord-backed layer hoisting bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test 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
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | tests/RecordReplaceDrawTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRecordReplaceDraw.cpp
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index f0abd6481e70535e86d31c0ce18214f3f694b4c1..b53f003904df3854a8eea59554108fd315e16209 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -51,13 +51,18 @@ GrReplacements::lookupByStart(size_t start, int* searchStart) const {
}
static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo* ri,
- SkCanvas* canvas) {
+ SkCanvas* canvas,
+ const SkMatrix& initialMatrix) {
SkRect src = SkRect::Make(ri->fSrcRect);
SkRect dst = SkRect::MakeXYWH(SkIntToScalar(ri->fPos.fX),
SkIntToScalar(ri->fPos.fY),
SkIntToScalar(ri->fSrcRect.width()),
SkIntToScalar(ri->fSrcRect.height()));
+
+ canvas->save();
+ canvas->setMatrix(initialMatrix);
ri->fImage->draw(canvas, &src, dst, ri->fPaint);
+ canvas->restore();
}
void GrRecordReplaceDraw(const SkRecord& record,
@@ -71,6 +76,8 @@ void GrRecordReplaceDraw(const SkRecord& record,
const GrReplacements::ReplacementInfo* ri = NULL;
int searchStart = 0;
+ const SkMatrix initialMatrix = canvas->getTotalMatrix();
+
if (bbh) {
// Draw only ops that affect pixels in the canvas's current clip.
// The SkRecord and BBH were recorded in identity space. This canvas
@@ -89,7 +96,7 @@ void GrRecordReplaceDraw(const SkRecord& record,
}
ri = replacements->lookupByStart((uintptr_t)ops[i], &searchStart);
if (ri) {
- draw_replacement_bitmap(ri, canvas);
+ draw_replacement_bitmap(ri, canvas, initialMatrix);
while ((uintptr_t)ops[i] < ri->fStop) {
++i;
@@ -107,8 +114,7 @@ void GrRecordReplaceDraw(const SkRecord& record,
}
ri = replacements->lookupByStart(i, &searchStart);
if (ri) {
- draw_replacement_bitmap(ri, canvas);
-
+ draw_replacement_bitmap(ri, canvas, initialMatrix);
i = ri->fStop;
continue;
}
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | tests/RecordReplaceDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698