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

Side by Side Diff: gm/imagefilterstransformed.cpp

Issue 1902253003: add gm to exercise rotated imagefiltesr w/ and w/o antialiasing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 canvas->restore(); 106 canvas->restore();
107 canvas->translate(0, size + margin); 107 canvas->translate(0, size + margin);
108 } 108 }
109 } 109 }
110 110
111 private: 111 private:
112 sk_sp<SkImage> fCheckerboard; 112 sk_sp<SkImage> fCheckerboard;
113 sk_sp<SkImage> fGradientCircle; 113 sk_sp<SkImage> fGradientCircle;
114 typedef GM INHERITED; 114 typedef GM INHERITED;
115 }; 115 };
116 DEF_GM( return new ImageFiltersTransformedGM; )
117 }
116 118
117 ////////////////////////////////////////////////////////////////////////////// 119 //////////////////////////////////////////////////////////////////////////////
120 #include "SkXfermodeImageFilter.h"
118 121
119 DEF_GM( return new ImageFiltersTransformedGM; ) 122 DEF_SIMPLE_GM(rotate_imagefilter, canvas, 500, 500) {
123 SkPaint paint;
120 124
125 const SkRect r = SkRect::MakeXYWH(50, 50, 100, 100);
126
127 sk_sp<SkImageFilter> filters[] = {
128 nullptr,
129 SkBlurImageFilter::Make(6, 0, nullptr),
130 SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode), nullptr),
131 };
132
133 for (auto& filter : filters) {
134 paint.setAntiAlias(false);
135 paint.setImageFilter(filter);
136
137 canvas->save();
138
139 canvas->drawRect(r, paint);
140
141 canvas->translate(150, 0);
142 canvas->save();
143 canvas->translate(100, 100);
144 canvas->rotate(30);
145 canvas->translate(-100, -100);
146 canvas->drawRect(r, paint);
147 canvas->restore();
148
149 paint.setAntiAlias(true);
150 canvas->translate(150, 0);
151 canvas->save();
152 canvas->translate(100, 100);
153 canvas->rotate(30);
154 canvas->translate(-100, -100);
155 canvas->drawRect(r, paint);
156 canvas->restore();
157
158 canvas->restore();
159 canvas->translate(0, 150);
160 }
121 } 161 }
OLDNEW
« 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