OLD | NEW |
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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 virtual void onDraw(SkCanvas* canvas) { | 42 virtual void onDraw(SkCanvas* canvas) { |
43 SkScalar x = SkIntToScalar(100); | 43 SkScalar x = SkIntToScalar(100); |
44 SkScalar y = SkIntToScalar(88); | 44 SkScalar y = SkIntToScalar(88); |
45 | 45 |
46 SkPaint paint; | 46 SkPaint paint; |
47 paint.setAntiAlias(true); | 47 paint.setAntiAlias(true); |
48 paint.setTextSize(SkIntToScalar(100)); | 48 paint.setTextSize(SkIntToScalar(100)); |
49 paint.setStrokeWidth(SkIntToScalar(5)); | 49 paint.setStrokeWidth(SkIntToScalar(5)); |
50 | 50 |
51 SkTypeface* face = SkTypeface::CreateFromName("Papyrus", SkTypeface::kNo
rmal); | 51 sk_tool_utils::set_portable_typeface(&paint, "Papyrus"); |
52 SkSafeUnref(paint.setTypeface(face)); | |
53 show_bold(canvas, "Hello", 5, x, y, paint); | 52 show_bold(canvas, "Hello", 5, x, y, paint); |
54 | 53 |
55 face = SkTypeface::CreateFromName("Hiragino Maru Gothic Pro", SkTypeface
::kNormal); | 54 sk_tool_utils::set_portable_typeface(&paint, "Hiragino Maru Gothic Pro")
; |
56 SkSafeUnref(paint.setTypeface(face)); | |
57 const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC }; | 55 const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC }; |
58 show_bold(canvas, hyphen, SK_ARRAY_COUNT(hyphen), x + SkIntToScalar(300)
, y, paint); | 56 show_bold(canvas, hyphen, SK_ARRAY_COUNT(hyphen), x + SkIntToScalar(300)
, y, paint); |
59 | 57 |
60 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 58 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
61 | 59 |
62 SkPath path; | 60 SkPath path; |
63 path.setFillType(SkPath::kWinding_FillType); | 61 path.setFillType(SkPath::kWinding_FillType); |
64 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW
_Direction); | 62 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW
_Direction); |
65 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCC
W_Direction); | 63 path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCC
W_Direction); |
66 canvas->drawPath(path, paint); | 64 canvas->drawPath(path, paint); |
(...skipping 19 matching lines...) Expand all Loading... |
86 private: | 84 private: |
87 typedef GM INHERITED; | 85 typedef GM INHERITED; |
88 }; | 86 }; |
89 | 87 |
90 ////////////////////////////////////////////////////////////////////////////// | 88 ////////////////////////////////////////////////////////////////////////////// |
91 | 89 |
92 static GM* MyFactory(void*) { return new StrokeFillGM; } | 90 static GM* MyFactory(void*) { return new StrokeFillGM; } |
93 static GMRegistry reg(MyFactory); | 91 static GMRegistry reg(MyFactory); |
94 | 92 |
95 } | 93 } |
OLD | NEW |