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

Side by Side Diff: gm/filterfastbounds.cpp

Issue 1389063002: Revert of factories should return baseclass, allowing the impl to specialize (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/bigtileimagefilter.cpp ('k') | gm/pictureimagefilter.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 2014 Google Inc. 2 * Copyright 2014 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 "SkDropShadowImageFilter.h" 10 #include "SkDropShadowImageFilter.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SkAutoTUnref<SkImageFilter> rotMIF( 106 SkAutoTUnref<SkImageFilter> rotMIF(
107 SkImageFilter::CreateMatrixFilter(rot, kLow_SkFilterQuality, source) ); 107 SkImageFilter::CreateMatrixFilter(rot, kLow_SkFilterQuality, source) );
108 108
109 add_paint(rotMIF, paints); 109 add_paint(rotMIF, paints);
110 } 110 }
111 111
112 { 112 {
113 static const SkDropShadowImageFilter::ShadowMode kBoth = 113 static const SkDropShadowImageFilter::ShadowMode kBoth =
114 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode ; 114 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode ;
115 115
116 SkAutoTUnref<SkImageFilter> dsif( 116 SkAutoTUnref<SkDropShadowImageFilter> dsif(
117 SkDropShadowImageFilter::Create(10.0f, 10.0f, 117 SkDropShadowImageFilter::Create(10.0f, 10.0f,
118 3.0f, 3.0f, 118 3.0f, 3.0f,
119 SK_ColorRED, kBoth, 119 SK_ColorRED, kBoth,
120 source, nullptr)); 120 source, nullptr));
121 121
122 add_paint(dsif, paints); 122 add_paint(dsif, paints);
123 } 123 }
124 124
125 { 125 {
126 SkAutoTUnref<SkImageFilter> dsif( 126 SkAutoTUnref<SkDropShadowImageFilter> dsif(
127 SkDropShadowImageFilter::Create(27.0f, 27.0f, 127 SkDropShadowImageFilter::Create(27.0f, 27.0f,
128 3.0f, 3.0f, 128 3.0f, 3.0f,
129 SK_ColorRED, 129 SK_ColorRED,
130 SkDropShadowImageFilter::kDrawShadow Only_ShadowMode, 130 SkDropShadowImageFilter::kDrawShadow Only_ShadowMode,
131 source, nullptr)); 131 source, nullptr));
132 132
133 add_paint(dsif, paints); 133 add_paint(dsif, paints);
134 } 134 }
135 135
136 { 136 {
137 SkAutoTUnref<SkImageFilter> bif(SkBlurImageFilter::Create(3, 3, source)) ; 137 SkAutoTUnref<SkBlurImageFilter> bif(SkBlurImageFilter::Create(3, 3, sour ce));
138 138
139 add_paint(bif, paints); 139 add_paint(bif, paints);
140 } 140 }
141 141
142 { 142 {
143 SkAutoTUnref<SkImageFilter> oif(SkOffsetImageFilter::Create(15, 15, sour ce)); 143 SkAutoTUnref<SkOffsetImageFilter> oif(SkOffsetImageFilter::Create(15, 15 , source));
144 144
145 add_paint(oif, paints); 145 add_paint(oif, paints);
146 } 146 }
147 } 147 }
148 148
149 // This GM visualizes the fast bounds for various combinations of geometry 149 // This GM visualizes the fast bounds for various combinations of geometry
150 // and image filter 150 // and image filter
151 class ImageFilterFastBoundGM : public GM { 151 class ImageFilterFastBoundGM : public GM {
152 public: 152 public:
153 ImageFilterFastBoundGM() { 153 ImageFilterFastBoundGM() {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 SkAutoTUnref<SkPicture> pic; 239 SkAutoTUnref<SkPicture> pic;
240 240
241 { 241 {
242 SkPictureRecorder rec; 242 SkPictureRecorder rec;
243 243
244 SkCanvas* c = rec.beginRecording(10, 10); 244 SkCanvas* c = rec.beginRecording(10, 10);
245 c->drawRect(SkRect::MakeWH(10, 10), blackFill); 245 c->drawRect(SkRect::MakeWH(10, 10), blackFill);
246 pic.reset(rec.endRecording()); 246 pic.reset(rec.endRecording());
247 } 247 }
248 248
249 SkAutoTUnref<SkImageFilter> pif(SkPictureImageFilter::Create(pic)); 249 SkAutoTUnref<SkPictureImageFilter> pif(SkPictureImageFilter::Create(pic) );
250 250
251 SkTArray<SkPaint> pifPaints; 251 SkTArray<SkPaint> pifPaints;
252 create_paints(pif, &pifPaints); 252 create_paints(pif, &pifPaints);
253 253
254 //----------- 254 //-----------
255 // Paints with a SkImageSource as a source 255 // Paints with a SkImageSource as a source
256 256
257 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); 257 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
258 { 258 {
259 SkPaint p; 259 SkPaint p;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 private: 319 private:
320 typedef GM INHERITED; 320 typedef GM INHERITED;
321 }; 321 };
322 322
323 ////////////////////////////////////////////////////////////////////////////// 323 //////////////////////////////////////////////////////////////////////////////
324 324
325 DEF_GM(return new ImageFilterFastBoundGM;) 325 DEF_GM(return new ImageFilterFastBoundGM;)
326 } 326 }
OLDNEW
« no previous file with comments | « gm/bigtileimagefilter.cpp ('k') | gm/pictureimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698