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

Side by Side Diff: gm/largeglyphblur.cpp

Issue 1852113003: switch maskfilters to sk_sp (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 | « gm/emboss.cpp ('k') | gm/megalooper.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 BD-style license that can be 4 * Use of this source code is governed by a BD-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 "SkBlurMask.h" 10 #include "SkBlurMask.h"
11 #include "SkBlurMaskFilter.h" 11 #include "SkBlurMaskFilter.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkTextBlob.h" 13 #include "SkTextBlob.h"
14 14
15 // This test ensures that glyphs whose point size is less than the SkGlyphCache' s maxmium, but 15 // This test ensures that glyphs whose point size is less than the SkGlyphCache' s maxmium, but
16 // who have a large blur, are still handled correctly 16 // who have a large blur, are still handled correctly
17 DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600) { 17 DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600) {
18 const char text[] = "Hamburgefons"; 18 const char text[] = "Hamburgefons";
19 19
20 SkPaint paint; 20 SkPaint paint;
21 sk_tool_utils::set_portable_typeface(&paint); 21 sk_tool_utils::set_portable_typeface(&paint);
22 paint.setTextSize(256); 22 paint.setTextSize(256);
23 paint.setAntiAlias(true); 23 paint.setAntiAlias(true);
24 24
25 // setup up maskfilter 25 // setup up maskfilter
26 static const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToS calar(40)); 26 static const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToS calar(40));
27 27
28 SkPaint blurPaint(paint); 28 SkPaint blurPaint(paint);
29 SkAutoTUnref<SkMaskFilter> mf(SkBlurMaskFilter::Create(kNormal_SkBlurSty le, kSigma)); 29 blurPaint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, kSig ma));
30 blurPaint.setMaskFilter(mf);
31 30
32 SkTextBlobBuilder builder; 31 SkTextBlobBuilder builder;
33 32
34 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0); 33 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0);
35 34
36 SkAutoTUnref<const SkTextBlob> blob(builder.build()); 35 SkAutoTUnref<const SkTextBlob> blob(builder.build());
37 canvas->drawTextBlob(blob.get(), 10, 200, blurPaint); 36 canvas->drawTextBlob(blob.get(), 10, 200, blurPaint);
38 canvas->drawTextBlob(blob.get(), 10, 200, paint); 37 canvas->drawTextBlob(blob.get(), 10, 200, paint);
39 38
40 size_t len = strlen(text); 39 size_t len = strlen(text);
41 canvas->drawText(text, len, 10, 500, blurPaint); 40 canvas->drawText(text, len, 10, 500, blurPaint);
42 canvas->drawText(text, len, 10, 500, paint); 41 canvas->drawText(text, len, 10, 500, paint);
43 } 42 }
OLDNEW
« no previous file with comments | « gm/emboss.cpp ('k') | gm/megalooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698