| 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 22 matching lines...) Expand all Loading... |
| 33 and test all the code paths through the clipping blitters. | 33 and test all the code paths through the clipping blitters. |
| 34 Each region should show as a blue center surrounded by a 2px green | 34 Each region should show as a blue center surrounded by a 2px green |
| 35 border, with no red. | 35 border, with no red. |
| 36 */ | 36 */ |
| 37 | 37 |
| 38 #define HEIGHT 480 | 38 #define HEIGHT 480 |
| 39 | 39 |
| 40 class GammaTextGM : public skiagm::GM { | 40 class GammaTextGM : public skiagm::GM { |
| 41 protected: | 41 protected: |
| 42 SkString onShortName() override { | 42 SkString onShortName() override { |
| 43 return SkString("gammatext"); | 43 SkString name("gammatext"); |
| 44 name.append(sk_tool_utils::major_platform_os_name()); |
| 45 return name; |
| 44 } | 46 } |
| 45 | 47 |
| 46 SkISize onISize() override { | 48 SkISize onISize() override { |
| 47 return SkISize::Make(1024, HEIGHT); | 49 return SkISize::Make(1024, HEIGHT); |
| 48 } | 50 } |
| 49 | 51 |
| 50 static void drawGrad(SkCanvas* canvas) { | 52 static void drawGrad(SkCanvas* canvas) { |
| 51 SkPoint pts[] = { { 0, 0 }, { 0, SkIntToScalar(HEIGHT) } }; | 53 SkPoint pts[] = { { 0, 0 }, { 0, SkIntToScalar(HEIGHT) } }; |
| 52 SkShader* s = make_heatGradient(pts); | 54 SkShader* s = make_heatGradient(pts); |
| 53 | 55 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 0xFFFFFFFF, | 67 0xFFFFFFFF, |
| 66 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF, | 68 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF, |
| 67 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, | 69 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, |
| 68 0xFF000000, | 70 0xFF000000, |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 const char* text = "Hamburgefons"; | 73 const char* text = "Hamburgefons"; |
| 72 size_t len = strlen(text); | 74 size_t len = strlen(text); |
| 73 | 75 |
| 74 SkPaint paint; | 76 SkPaint paint; |
| 75 setFont(&paint, "Times"); | 77 setFont(&paint, sk_tool_utils::platform_font_name("serif")); |
| 76 paint.setTextSize(SkIntToScalar(16)); | 78 paint.setTextSize(SkIntToScalar(16)); |
| 77 paint.setAntiAlias(true); | 79 paint.setAntiAlias(true); |
| 78 paint.setLCDRenderText(true); | 80 paint.setLCDRenderText(true); |
| 79 | 81 |
| 80 SkScalar x = SkIntToScalar(10); | 82 SkScalar x = SkIntToScalar(10); |
| 81 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { | 83 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { |
| 82 paint.setColor(fg[i]); | 84 paint.setColor(fg[i]); |
| 83 | 85 |
| 84 SkScalar y = SkIntToScalar(40); | 86 SkScalar y = SkIntToScalar(40); |
| 85 SkScalar stopy = SkIntToScalar(HEIGHT); | 87 SkScalar stopy = SkIntToScalar(HEIGHT); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 canvas->translate(0, 80); | 173 canvas->translate(0, 80); |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 | 176 |
| 175 private: | 177 private: |
| 176 typedef skiagm::GM INHERITED; | 178 typedef skiagm::GM INHERITED; |
| 177 }; | 179 }; |
| 178 | 180 |
| 179 DEF_GM( return new GammaShaderTextGM; ) | 181 DEF_GM( return new GammaShaderTextGM; ) |
| 180 | 182 |
| OLD | NEW |