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 "SkShader.h" | 9 #include "SkShader.h" |
10 using namespace skiagm; | 10 using namespace skiagm; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 void GM::drawGpuOnlyMessage(SkCanvas* canvas) { | 73 void GM::drawGpuOnlyMessage(SkCanvas* canvas) { |
74 SkBitmap bmp; | 74 SkBitmap bmp; |
75 bmp.allocN32Pixels(128, 64); | 75 bmp.allocN32Pixels(128, 64); |
76 SkCanvas bmpCanvas(bmp); | 76 SkCanvas bmpCanvas(bmp); |
77 bmpCanvas.drawColor(SK_ColorWHITE); | 77 bmpCanvas.drawColor(SK_ColorWHITE); |
78 SkPaint paint; | 78 SkPaint paint; |
79 paint.setAntiAlias(true); | 79 paint.setAntiAlias(true); |
80 paint.setTextSize(20); | 80 paint.setTextSize(20); |
81 paint.setColor(SK_ColorRED); | 81 paint.setColor(SK_ColorRED); |
| 82 sk_tool_utils::set_portable_typeface(&paint); |
82 static const char kTxt[] = "GPU Only"; | 83 static const char kTxt[] = "GPU Only"; |
83 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); | 84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); |
84 SkMatrix localM; | 85 SkMatrix localM; |
85 localM.setRotate(35.f); | 86 localM.setRotate(35.f); |
86 localM.postTranslate(10.f, 0.f); | 87 localM.postTranslate(10.f, 0.f); |
87 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(bmp, SkShader::kM
irror_TileMode, | 88 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(bmp, SkShader::kM
irror_TileMode, |
88 SkShader::kMirror
_TileMode, | 89 SkShader::kMirror
_TileMode, |
89 &localM)); | 90 &localM)); |
90 paint.setShader(shader); | 91 paint.setShader(shader); |
91 paint.setFilterQuality(kMedium_SkFilterQuality); | 92 paint.setFilterQuality(kMedium_SkFilterQuality); |
92 canvas->drawPaint(paint); | 93 canvas->drawPaint(paint); |
93 return; | 94 return; |
94 } | 95 } |
95 | 96 |
96 // need to explicitly declare this, or we get some weird infinite loop llist | 97 // need to explicitly declare this, or we get some weird infinite loop llist |
97 template GMRegistry* GMRegistry::gHead; | 98 template GMRegistry* GMRegistry::gHead; |
98 | 99 |
99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { | 100 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { |
100 fDrawProc(canvas); | 101 fDrawProc(canvas); |
101 } | 102 } |
102 | 103 |
103 SkISize skiagm::SimpleGM::onISize() { | 104 SkISize skiagm::SimpleGM::onISize() { |
104 return fSize; | 105 return fSize; |
105 } | 106 } |
106 | 107 |
107 SkString skiagm::SimpleGM::onShortName() { | 108 SkString skiagm::SimpleGM::onShortName() { |
108 return fName; | 109 return fName; |
109 } | 110 } |
110 | 111 |
OLD | NEW |