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

Unified Diff: gm/imagefiltersclipped.cpp

Issue 1245983002: Run noise shader separately in imagefiltersclipped (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersclipped.cpp
diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp
index cc636aa276453415319b48427fc9e55783fd9bbb..e15fe6881e2c798138486484cb2a6e3abcdf1eb4 100644
--- a/gm/imagefiltersclipped.cpp
+++ b/gm/imagefiltersclipped.cpp
@@ -91,7 +91,6 @@ protected:
SkErodeImageFilter::Create(2, 2, checkerboard.get()),
SkOffsetImageFilter::Create(SkIntToScalar(-16), SkIntToScalar(32)),
SkImageFilter::CreateMatrixFilter(resizeMatrix, kNone_SkFilterQuality),
- SkRectShaderImageFilter::Create(noise),
};
SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
@@ -99,6 +98,7 @@ protected:
SkRect bounds = r;
bounds.outset(margin, margin);
+ canvas->save();
for (int xOffset = 0; xOffset < 80; xOffset += 16) {
canvas->save();
bounds.fLeft = SkIntToScalar(xOffset);
@@ -122,10 +122,26 @@ protected:
canvas->restore();
canvas->translate(0, r.height() + margin);
}
+ canvas->restore();
for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
SkSafeUnref(filters[i]);
}
+
robertphillips 2015/07/21 14:38:41 leak? Mv 'noise' down here too?
jvanverth1 2015/07/21 15:30:45 Done.
+ SkImageFilter* rectFilter = SkRectShaderImageFilter::Create(noise);
+ canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0);
+ for (int xOffset = 0; xOffset < 80; xOffset += 16) {
robertphillips 2015/07/21 14:38:42 Would it be clearer if this were a subroutine: dr
jvanverth1 2015/07/21 15:30:45 Done.
+ canvas->save();
+ bounds.fLeft = SkIntToScalar(xOffset);
+ SkPaint paint;
+ paint.setColor(SK_ColorWHITE);
+ paint.setImageFilter(rectFilter);
+ paint.setAntiAlias(true);
+ canvas->clipRect(bounds);
+ canvas->drawCircle(r.centerX(), r.centerY(), r.width() * 2 / 5, paint);
+ canvas->restore();
+ canvas->translate(0, r.height() + margin);
+ }
}
private:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698