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

Side by Side Diff: gm/imagefilters.cpp

Issue 2357333002: allow clip calls w/o op param, remove unnecessary kReplace ops (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/path_stroke_with_zero_length.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorMatrixFilter.h" 10 #include "SkColorMatrixFilter.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 #include "SkRRect.h" 115 #include "SkRRect.h"
116 116
117 static void draw_set(SkCanvas* canvas, sk_sp<SkImageFilter> filters[], int count ) { 117 static void draw_set(SkCanvas* canvas, sk_sp<SkImageFilter> filters[], int count ) {
118 const SkRect r = SkRect::MakeXYWH(30, 30, 200, 200); 118 const SkRect r = SkRect::MakeXYWH(30, 30, 200, 200);
119 const SkScalar offset = 250; 119 const SkScalar offset = 250;
120 SkScalar dx = 0, dy = 0; 120 SkScalar dx = 0, dy = 0;
121 121
122 for (int i = 0; i < count; ++i) { 122 for (int i = 0; i < count; ++i) {
123 canvas->save(); 123 canvas->save();
124 SkRRect rr = SkRRect::MakeRectXY(r.makeOffset(dx, dy), 20, 20); 124 SkRRect rr = SkRRect::MakeRectXY(r.makeOffset(dx, dy), 20, 20);
125 canvas->clipRRect(rr, SkCanvas::kIntersect_Op, true); 125 canvas->clipRRect(rr, true);
126 canvas->saveLayer({ &rr.getBounds(), nullptr, filters[i].get(), 0 }); 126 canvas->saveLayer({ &rr.getBounds(), nullptr, filters[i].get(), 0 });
127 canvas->drawColor(0x40FFFFFF); 127 canvas->drawColor(0x40FFFFFF);
128 canvas->restore(); 128 canvas->restore();
129 canvas->restore(); 129 canvas->restore();
130 130
131 if (0 == dx) { 131 if (0 == dx) {
132 dx = offset; 132 dx = offset;
133 } else { 133 } else {
134 dx = 0; 134 dx = 0;
135 dy = offset; 135 dy = offset;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 canvas->translate(20, 20); 168 canvas->translate(20, 20);
169 for (const auto& xform : xforms) { 169 for (const auto& xform : xforms) {
170 canvas->save(); 170 canvas->save();
171 canvas->translate(xform.fTx, xform.fTy); 171 canvas->translate(xform.fTx, xform.fTy);
172 canvas->scale(xform.fSx, xform.fSy); 172 canvas->scale(xform.fSx, xform.fSy);
173 canvas->drawImage(image, 0, 0, &paint); 173 canvas->drawImage(image, 0, 0, &paint);
174 draw_set(canvas, filters, SK_ARRAY_COUNT(filters)); 174 draw_set(canvas, filters, SK_ARRAY_COUNT(filters));
175 canvas->restore(); 175 canvas->restore();
176 } 176 }
177 } 177 }
OLDNEW
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/path_stroke_with_zero_length.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698