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

Side by Side Diff: gm/fontscaler.cpp

Issue 1256903002: make fontscalar gammatext lcdtext typeface verttext2 gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove useless gm; fix nit Created 5 years, 5 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 | gm/gammatext.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 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkTypeface.h" 8 #include "SkTypeface.h"
9 9
10 namespace skiagm { 10 namespace skiagm {
11 11
12 class FontScalerGM : public GM { 12 class FontScalerGM : public GM {
13 public: 13 public:
14 FontScalerGM() { 14 FontScalerGM() {
15 this->setBGColor(0xFFFFFFFF); 15 this->setBGColor(0xFFFFFFFF);
16 } 16 }
17 17
18 virtual ~FontScalerGM() { 18 virtual ~FontScalerGM() {
19 } 19 }
20 20
21 protected: 21 protected:
22 22
23 SkString onShortName() override { 23 SkString onShortName() override {
24 return SkString("fontscaler"); 24 SkString name("fontscaler");
25 name.append(sk_tool_utils::major_platform_os_name());
26 return name;
25 } 27 }
26 28
27 SkISize onISize() override { 29 SkISize onISize() override {
28 return SkISize::Make(1450, 750); 30 return SkISize::Make(1450, 750);
29 } 31 }
30 32
31 static void rotate_about(SkCanvas* canvas, 33 static void rotate_about(SkCanvas* canvas,
32 SkScalar degrees, 34 SkScalar degrees,
33 SkScalar px, SkScalar py) { 35 SkScalar px, SkScalar py) {
34 canvas->translate(px, py); 36 canvas->translate(px, py);
35 canvas->rotate(degrees); 37 canvas->rotate(degrees);
36 canvas->translate(-px, -py); 38 canvas->translate(-px, -py);
37 } 39 }
38 40
39 void onDraw(SkCanvas* canvas) override { 41 void onDraw(SkCanvas* canvas) override {
40 SkPaint paint; 42 SkPaint paint;
41 43
42 paint.setAntiAlias(true); 44 paint.setAntiAlias(true);
43 paint.setLCDRenderText(true); 45 paint.setLCDRenderText(true);
44 //With freetype the default (normal hinting) can be really ugly. 46 //With freetype the default (normal hinting) can be really ugly.
45 //Most distros now set slight (vertical hinting only) in any event. 47 //Most distros now set slight (vertical hinting only) in any event.
46 paint.setHinting(SkPaint::kSlight_Hinting); 48 paint.setHinting(SkPaint::kSlight_Hinting);
47 sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface:: kNormal);
48 49
49 const char* text = "Hamburgefons ooo mmm"; 50 const char* text = "Hamburgefons ooo mmm";
50 const size_t textLen = strlen(text); 51 const size_t textLen = strlen(text);
51 52
52 for (int j = 0; j < 2; ++j) { 53 for (int j = 0; j < 2; ++j) {
53 // This used to do 6 iterations but it causes the N4 to crash in the MSAA4 config. 54 // This used to do 6 iterations but it causes the N4 to crash in the MSAA4 config.
54 for (int i = 0; i < 5; ++i) { 55 for (int i = 0; i < 5; ++i) {
55 SkScalar x = SkIntToScalar(10); 56 SkScalar x = SkIntToScalar(10);
56 SkScalar y = SkIntToScalar(20); 57 SkScalar y = SkIntToScalar(20);
57 58
(...skipping 25 matching lines...) Expand all
83 private: 84 private:
84 typedef GM INHERITED; 85 typedef GM INHERITED;
85 }; 86 };
86 87
87 ////////////////////////////////////////////////////////////////////////////// 88 //////////////////////////////////////////////////////////////////////////////
88 89
89 static GM* MyFactory(void*) { return new FontScalerGM; } 90 static GM* MyFactory(void*) { return new FontScalerGM; }
90 static GMRegistry reg(MyFactory); 91 static GMRegistry reg(MyFactory);
91 92
92 } 93 }
OLDNEW
« no previous file with comments | « no previous file | gm/gammatext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698