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

Side by Side Diff: gm/largeglyphblur.cpp

Issue 1135113002: Fix blur on large glyphs in runs < SkGlyphCache::max (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: a bit more Created 5 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 | gyp/gmslides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9
10 #include "SkBlurMask.h"
11 #include "SkBlurMaskFilter.h"
12 #include "SkCanvas.h"
13 #include "SkTextBlob.h"
14
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
17 namespace skiagm {
18 class LargeGlyphBlur : public GM {
19 public:
20 LargeGlyphBlur() {}
21
22 protected:
23 SkString onShortName() override {
24 return SkString("largeglyphblur");
25 }
26
27 SkISize onISize() override {
28 return SkISize::Make(kWidth, kHeight);
29 }
30
31 void onDraw(SkCanvas* canvas) override {
32 const char text[] = "Hamburgefons";
33
34 SkPaint paint;
35 sk_tool_utils::set_portable_typeface(&paint);
36 paint.setTextSize(256);
37 paint.setAntiAlias(true);
38
39 // setup up maskfilter
40 static const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToS calar(40));
41
42 SkPaint blurPaint(paint);
43 SkAutoTUnref<SkMaskFilter> mf(SkBlurMaskFilter::Create(kNormal_SkBlurSty le, kSigma));
44 blurPaint.setMaskFilter(mf);
45
46 SkTextBlobBuilder builder;
47
48 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, 0);
49
50 SkAutoTUnref<const SkTextBlob> blob(builder.build());
51 canvas->drawTextBlob(blob.get(), 10, 200, blurPaint);
52 canvas->drawTextBlob(blob.get(), 10, 200, paint);
53
54 size_t len = strlen(text);
55 canvas->drawText(text, len, 10, 500, blurPaint);
56 canvas->drawText(text, len, 10, 500, paint);
57 }
58
59 private:
60 static const int kWidth = 1920;
61 static const int kHeight = 600;
62
63 typedef GM INHERITED;
64 };
65
66 //////////////////////////////////////////////////////////////////////////////
67
68 DEF_GM( return SkNEW(LargeGlyphBlur); )
69 }
OLDNEW
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698