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

Side by Side Diff: gm/pictureimagefilter.cpp

Issue 1972213002: Fix bug & add code to catch ImageFilter clearing bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch #define Created 4 years, 7 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 | src/core/SkSpecialSurface.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 2013 Google Inc. 2 * Copyright 2013 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 9
10 #include "SkPictureImageFilter.h" 10 #include "SkPictureImageFilter.h"
11 #include "SkPictureRecorder.h" 11 #include "SkPictureRecorder.h"
12 12
13 // This GM exercises the SkPictureImageFilter ImageFilter class. 13 // This GM exercises the SkPictureImageFilter ImageFilter class.
14 14
15 static void fill_rect_filtered(SkCanvas* canvas, 15 static void fill_rect_filtered(SkCanvas* canvas,
16 const SkRect& clipRect, 16 const SkRect& clipRect,
17 sk_sp<SkImageFilter> filter) { 17 sk_sp<SkImageFilter> filter) {
18 SkPaint paint; 18 SkPaint paint;
19 paint.setImageFilter(filter); 19 paint.setImageFilter(filter);
20 canvas->save(); 20 canvas->save();
21 canvas->clipRect(clipRect); 21 canvas->clipRect(clipRect);
22 canvas->drawPaint(paint); 22 canvas->drawPaint(paint);
23 canvas->restore(); 23 canvas->restore();
24 } 24 }
25 25
26 static sk_sp<SkPicture> make_picture() { 26 static sk_sp<SkPicture> make_picture() {
27 SkPictureRecorder recorder; 27 SkPictureRecorder recorder;
28 SkCanvas* canvas = recorder.beginRecording(100, 100, nullptr, 0); 28 SkCanvas* canvas = recorder.beginRecording(100, 100, nullptr, 0);
29 canvas->clear(SK_ColorBLACK);
30 SkPaint paint; 29 SkPaint paint;
31 paint.setAntiAlias(true); 30 paint.setAntiAlias(true);
32 sk_tool_utils::set_portable_typeface(&paint); 31 sk_tool_utils::set_portable_typeface(&paint);
33 paint.setColor(0xFFFFFFFF); 32 paint.setColor(0xFFFFFFFF);
34 paint.setTextSize(SkIntToScalar(96)); 33 paint.setTextSize(SkIntToScalar(96));
35 const char* str = "e"; 34 const char* str = "e";
36 canvas->drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), pai nt); 35 canvas->drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70), pai nt);
37 return recorder.finishRecordingAsPicture(); 36 return recorder.finishRecordingAsPicture();
38 } 37 }
39 38
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 private: 143 private:
145 sk_sp<SkPicture> fPicture; 144 sk_sp<SkPicture> fPicture;
146 sk_sp<SkPicture> fLCDPicture; 145 sk_sp<SkPicture> fLCDPicture;
147 146
148 typedef GM INHERITED; 147 typedef GM INHERITED;
149 }; 148 };
150 149
151 /////////////////////////////////////////////////////////////////////////////// 150 ///////////////////////////////////////////////////////////////////////////////
152 151
153 DEF_GM( return new PictureImageFilterGM; ) 152 DEF_GM( return new PictureImageFilterGM; )
OLDNEW
« no previous file with comments | « no previous file | src/core/SkSpecialSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698