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

Side by Side Diff: gm/glyph_pos.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/giantbitmap.cpp ('k') | gm/glyph_pos_align.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
11 11
12 /* This test tries to define the effect of using hairline strokes on text. 12 /* This test tries to define the effect of using hairline strokes on text.
13 * Provides non-hairline images for reference and consistency checks. 13 * Provides non-hairline images for reference and consistency checks.
14 * glyph_pos_(h/n)_(s/f/b) 14 * glyph_pos_(h/n)_(s/f/b)
15 * -> test hairline/non-hairline stroke/fill/stroke+fill. 15 * -> test hairline/non-hairline stroke/fill/stroke+fill.
16 */ 16 */
17 static const SkScalar kTextHeight = 14.0f; 17 static const SkScalar kTextHeight = 14.0f;
18 static const char kText[] = "Proportional Hamburgefons #% fi"; 18 static const char kText[] = "Proportional Hamburgefons #% fi";
19 19
20 namespace skiagm { 20 namespace skiagm {
21 21
22 class GlyphPosGM : public GM { 22 class GlyphPosGM : public GM {
23 public: 23 public:
24 GlyphPosGM(SkScalar strokeWidth, SkPaint::Style strokeStyle) 24 GlyphPosGM(SkScalar strokeWidth, SkPaint::Style strokeStyle)
25 : fStrokeWidth(strokeWidth) 25 : fStrokeWidth(strokeWidth)
26 , fStrokeStyle(strokeStyle) { 26 , fStrokeStyle(strokeStyle) {
27 } 27 }
28 28
29 protected: 29 protected:
30 virtual uint32_t onGetFlags() const SK_OVERRIDE { 30 uint32_t onGetFlags() const SK_OVERRIDE {
31 return kSkipTiled_Flag; 31 return kSkipTiled_Flag;
32 } 32 }
33 33
34 virtual SkString onShortName() SK_OVERRIDE { 34 SkString onShortName() SK_OVERRIDE {
35 SkString str("glyph_pos"); 35 SkString str("glyph_pos");
36 if (fStrokeWidth == 0.0f) { 36 if (fStrokeWidth == 0.0f) {
37 str.append("_h"); // h == Hairline. 37 str.append("_h"); // h == Hairline.
38 } else { 38 } else {
39 str.append("_n"); // n == Normal. 39 str.append("_n"); // n == Normal.
40 } 40 }
41 if (fStrokeStyle == SkPaint::kStroke_Style) { 41 if (fStrokeStyle == SkPaint::kStroke_Style) {
42 str.append("_s"); 42 str.append("_s");
43 } else if (fStrokeStyle == SkPaint::kFill_Style) { 43 } else if (fStrokeStyle == SkPaint::kFill_Style) {
44 str.append("_f"); 44 str.append("_f");
45 } else { 45 } else {
46 str.append("_b"); // b == Both. 46 str.append("_b"); // b == Both.
47 } 47 }
48 return str; 48 return str;
49 } 49 }
50 50
51 virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 600); } 51 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 600); }
52 52
53 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 53 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
54 if (!fProp) { 54 if (!fProp) {
55 fProp.reset(sk_tool_utils::create_portable_typeface("Helvetica", SkT ypeface::kNormal)); 55 fProp.reset(sk_tool_utils::create_portable_typeface("Helvetica", SkT ypeface::kNormal));
56 } 56 }
57 57
58 // There's a black pixel at 40, 40 for reference. 58 // There's a black pixel at 40, 40 for reference.
59 canvas->drawPoint(40.0f, 40.0f, SK_ColorBLACK); 59 canvas->drawPoint(40.0f, 40.0f, SK_ColorBLACK);
60 60
61 // Two reference images. 61 // Two reference images.
62 canvas->translate(50.0f, 50.0f); 62 canvas->translate(50.0f, 50.0f);
63 drawTestCase(canvas, 1.0f); 63 drawTestCase(canvas, 1.0f);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); 196 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory);
197 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); 197 static GMRegistry reg2(GlyphPosStrokeAndFillFactory);
198 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); 198 static GMRegistry reg3(GlyphPosHairlineStrokeFactory);
199 static GMRegistry reg4(GlyphPosStrokeFactory); 199 static GMRegistry reg4(GlyphPosStrokeFactory);
200 static GMRegistry reg5(GlyphPosHairlineFillFactory); 200 static GMRegistry reg5(GlyphPosHairlineFillFactory);
201 static GMRegistry reg6(GlyphPosFillFactory); 201 static GMRegistry reg6(GlyphPosFillFactory);
202 202
203 203
204 } 204 }
OLDNEW
« no previous file with comments | « gm/giantbitmap.cpp ('k') | gm/glyph_pos_align.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698