OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gm.h" | 9 #include "gm.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 shaderA->unref(); | 44 shaderA->unref(); |
45 shaderB->unref(); | 45 shaderB->unref(); |
46 mode->unref(); | 46 mode->unref(); |
47 } | 47 } |
48 | 48 |
49 virtual ~ShaderGM() { | 49 virtual ~ShaderGM() { |
50 SkSafeUnref(fShader); | 50 SkSafeUnref(fShader); |
51 } | 51 } |
52 | 52 |
53 protected: | 53 protected: |
| 54 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 55 return kSkipTiled_Flag; |
| 56 } |
| 57 |
54 virtual SkString onShortName() SK_OVERRIDE { | 58 virtual SkString onShortName() SK_OVERRIDE { |
55 return SkString("composeshader"); | 59 return SkString("composeshader"); |
56 } | 60 } |
57 | 61 |
58 virtual SkISize onISize() SK_OVERRIDE { | 62 virtual SkISize onISize() SK_OVERRIDE { |
59 return make_isize(120, 120); | 63 return make_isize(120, 120); |
60 } | 64 } |
61 | 65 |
62 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 66 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
63 | 67 |
64 SkPaint paint; | 68 SkPaint paint; |
65 | 69 |
66 paint.setColor(SK_ColorGREEN); | 70 paint.setColor(SK_ColorGREEN); |
67 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); | 71 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); |
68 paint.setShader(fShader); | 72 paint.setShader(fShader); |
69 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); | 73 canvas->drawRectCoords(0, 0, SkIntToScalar(100), SkIntToScalar(100), pai
nt); |
70 } | 74 } |
71 | 75 |
72 private: | 76 private: |
73 SkShader* fShader; | 77 SkShader* fShader; |
74 typedef GM INHERITED ; | 78 typedef GM INHERITED ; |
75 }; | 79 }; |
76 | 80 |
77 ////////////////////////////////////////////////////////////////////////////// | 81 ////////////////////////////////////////////////////////////////////////////// |
78 | 82 |
79 static GM* MyFactory(void*) { return new ShaderGM; } | 83 static GM* MyFactory(void*) { return new ShaderGM; } |
80 static GMRegistry reg(MyFactory); | 84 static GMRegistry reg(MyFactory); |
81 | 85 |
82 } // namespace | 86 } // namespace |
OLD | NEW |