| 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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 static const int kTextLen = SK_ARRAY_COUNT(kText) - 1; | 45 static const int kTextLen = SK_ARRAY_COUNT(kText) - 1; |
| 46 static const int kPointSize = 300; | 46 static const int kPointSize = 300; |
| 47 | 47 |
| 48 class ShaderText3GM : public GM { | 48 class ShaderText3GM : public GM { |
| 49 public: | 49 public: |
| 50 ShaderText3GM() { | 50 ShaderText3GM() { |
| 51 this->setBGColor(0xFFDDDDDD); | 51 this->setBGColor(0xFFDDDDDD); |
| 52 } | 52 } |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 55 uint32_t onGetFlags() const SK_OVERRIDE { |
| 56 return kSkipTiled_Flag; | 56 return kSkipTiled_Flag; |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual SkString onShortName() SK_OVERRIDE { | 59 SkString onShortName() SK_OVERRIDE { |
| 60 return SkString("shadertext3"); | 60 return SkString("shadertext3"); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual SkISize onISize() SK_OVERRIDE{ return SkISize::Make(800, 1000); } | 63 SkISize onISize() SK_OVERRIDE{ return SkISize::Make(800, 1000); } |
| 64 | 64 |
| 65 virtual void onOnceBeforeDraw() SK_OVERRIDE { | 65 void onOnceBeforeDraw() SK_OVERRIDE { |
| 66 makebm(&fBmp, kPointSize / 4, kPointSize / 4); | 66 makebm(&fBmp, kPointSize / 4, kPointSize / 4); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 69 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 70 | 70 |
| 71 SkPaint bmpPaint; | 71 SkPaint bmpPaint; |
| 72 bmpPaint.setAntiAlias(true); | 72 bmpPaint.setAntiAlias(true); |
| 73 bmpPaint.setFilterLevel(SkPaint::kLow_FilterLevel); | 73 bmpPaint.setFilterLevel(SkPaint::kLow_FilterLevel); |
| 74 bmpPaint.setAlpha(0x80); | 74 bmpPaint.setAlpha(0x80); |
| 75 canvas->drawBitmap(fBmp, 5.f, 5.f, &bmpPaint); | 75 canvas->drawBitmap(fBmp, 5.f, 5.f, &bmpPaint); |
| 76 | 76 |
| 77 SkPaint outlinePaint; | 77 SkPaint outlinePaint; |
| 78 outlinePaint.setAntiAlias(true); | 78 outlinePaint.setAntiAlias(true); |
| 79 sk_tool_utils::set_portable_typeface(&outlinePaint); | 79 sk_tool_utils::set_portable_typeface(&outlinePaint); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 private: | 133 private: |
| 134 SkBitmap fBmp; | 134 SkBitmap fBmp; |
| 135 typedef GM INHERITED; | 135 typedef GM INHERITED; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 /////////////////////////////////////////////////////////////////////////////// | 138 /////////////////////////////////////////////////////////////////////////////// |
| 139 | 139 |
| 140 static GM* MyFactory(void*) { return new ShaderText3GM; } | 140 static GM* MyFactory(void*) { return new ShaderText3GM; } |
| 141 static GMRegistry reg(MyFactory); | 141 static GMRegistry reg(MyFactory); |
| 142 } | 142 } |
| OLD | NEW |