| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 sk_tool_utils::set_portable_typeface(&paint); |
| 83 static const char kTxt[] = "GPU Only"; | 83 constexpr char kTxt[] = "GPU Only"; |
| 84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); | 84 bmpCanvas.drawText(kTxt, strlen(kTxt), 20, 40, paint); |
| 85 SkMatrix localM; | 85 SkMatrix localM; |
| 86 localM.setRotate(35.f); | 86 localM.setRotate(35.f); |
| 87 localM.postTranslate(10.f, 0.f); | 87 localM.postTranslate(10.f, 0.f); |
| 88 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kMirror_TileMode, | 88 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kMirror_TileMode, |
| 89 SkShader::kMirror_TileMode, | 89 SkShader::kMirror_TileMode, |
| 90 &localM)); | 90 &localM)); |
| 91 paint.setFilterQuality(kMedium_SkFilterQuality); | 91 paint.setFilterQuality(kMedium_SkFilterQuality); |
| 92 canvas->drawPaint(paint); | 92 canvas->drawPaint(paint); |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 | 95 |
| 96 // need to explicitly declare this, or we get some weird infinite loop llist | 96 // need to explicitly declare this, or we get some weird infinite loop llist |
| 97 template GMRegistry* GMRegistry::gHead; | 97 template GMRegistry* GMRegistry::gHead; |
| 98 | 98 |
| 99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { | 99 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { |
| 100 fDrawProc(canvas); | 100 fDrawProc(canvas); |
| 101 } | 101 } |
| 102 | 102 |
| 103 SkISize skiagm::SimpleGM::onISize() { | 103 SkISize skiagm::SimpleGM::onISize() { |
| 104 return fSize; | 104 return fSize; |
| 105 } | 105 } |
| 106 | 106 |
| 107 SkString skiagm::SimpleGM::onShortName() { | 107 SkString skiagm::SimpleGM::onShortName() { |
| 108 return fName; | 108 return fName; |
| 109 } | 109 } |
| OLD | NEW |