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

Unified Diff: src/gpu/GrRecordReplaceDraw.cpp

Issue 803183003: Fix layer hoisting image filter corner cases (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test Created 6 years 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/GpuLayerCacheTest.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 852c51f4180dd155d9ad1c527d0ed9dc4111c960..0ceea3721fb806fdca40c437f39b1ca677613cbf 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -21,8 +21,6 @@ static inline void wrap_texture(GrTexture* texture, int width, int height, SkBit
}
static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canvas) {
- const SkRect src = SkRect::Make(layer->rect());
- const SkRect dst = SkRect::Make(layer->bound());
SkBitmap bm;
wrap_texture(layer->texture(),
@@ -30,10 +28,22 @@ static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canva
!layer->isAtlased() ? layer->rect().height() : layer->texture()->height(),
&bm);
- canvas->save();
- canvas->setMatrix(SkMatrix::I());
- canvas->drawBitmapRectToRect(bm, &src, dst, layer->paint());
- canvas->restore();
+ if (layer->isAtlased()) {
+ const SkRect src = SkRect::Make(layer->rect());
+ const SkRect dst = SkRect::Make(layer->srcIR());
+
+ SkASSERT(layer->offset().isZero());
+
+ canvas->save();
+ canvas->setMatrix(SkMatrix::I());
+ canvas->drawBitmapRectToRect(bm, &src, dst, layer->paint());
+ canvas->restore();
+ } else {
+ canvas->drawSprite(bm,
+ layer->srcIR().fLeft + layer->offset().fX,
+ layer->srcIR().fTop + layer->offset().fY,
+ layer->paint());
+ }
}
// Used by GrRecordReplaceDraw. It intercepts nested drawPicture calls and
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | tests/GpuLayerCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698