OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkGradientShader.h" | 8 #include "SkGradientShader.h" |
9 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 typedef SkShader* (*ShaderGenFunc)(SkScalar width, SkScalar height, | 29 typedef SkShader* (*ShaderGenFunc)(SkScalar width, SkScalar height, |
30 bool alternate, const SkMatrix& localMatr
ix); | 30 bool alternate, const SkMatrix& localMatr
ix); |
31 ShaderBoundsGM(ShaderGenFunc maker, const SkString& name) | 31 ShaderBoundsGM(ShaderGenFunc maker, const SkString& name) |
32 : fShaderMaker(maker), | 32 : fShaderMaker(maker), |
33 fName(name) { | 33 fName(name) { |
34 } | 34 } |
35 | 35 |
36 protected: | 36 protected: |
37 | 37 |
38 SkString onShortName() SK_OVERRIDE { | 38 SkString onShortName() override { |
39 return fName; | 39 return fName; |
40 } | 40 } |
41 | 41 |
42 SkISize onISize() SK_OVERRIDE { return SkISize::Make(320, 240); } | 42 SkISize onISize() override { return SkISize::Make(320, 240); } |
43 | 43 |
44 SkMatrix onGetInitialTransform() const SK_OVERRIDE { | 44 SkMatrix onGetInitialTransform() const override { |
45 SkMatrix result; | 45 SkMatrix result; |
46 SkScalar scale = 0.8f; | 46 SkScalar scale = 0.8f; |
47 result.setScale(scale, scale); | 47 result.setScale(scale, scale); |
48 result.postTranslate(SkIntToScalar(7), SkIntToScalar(23)); | 48 result.postTranslate(SkIntToScalar(7), SkIntToScalar(23)); |
49 return result; | 49 return result; |
50 } | 50 } |
51 | 51 |
52 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 52 void onDraw(SkCanvas* canvas) override { |
53 // The PDF device has already clipped to the content area, but we | 53 // The PDF device has already clipped to the content area, but we |
54 // do it again here so that the raster and pdf results are consistent. | 54 // do it again here so that the raster and pdf results are consistent. |
55 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(320), | 55 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(320), |
56 SkIntToScalar(240))); | 56 SkIntToScalar(240))); |
57 | 57 |
58 SkMatrix canvasScale; | 58 SkMatrix canvasScale; |
59 SkScalar scale = 0.7f; | 59 SkScalar scale = 0.7f; |
60 canvasScale.setScale(scale, scale); | 60 canvasScale.setScale(scale, scale); |
61 canvas->concat(canvasScale); | 61 canvas->concat(canvasScale); |
62 | 62 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 }; | 98 }; |
99 | 99 |
100 /////////////////////////////////////////////////////////////////////////////// | 100 /////////////////////////////////////////////////////////////////////////////// |
101 | 101 |
102 static GM* MyFactory(void*) { | 102 static GM* MyFactory(void*) { |
103 return new ShaderBoundsGM(MakeLinear, SkString("shaderbounds_linear")); | 103 return new ShaderBoundsGM(MakeLinear, SkString("shaderbounds_linear")); |
104 } | 104 } |
105 static GMRegistry reg(MyFactory); | 105 static GMRegistry reg(MyFactory); |
106 | 106 |
107 } | 107 } |
OLD | NEW |