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 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 pts[0].set(0, 0); | 29 pts[0].set(0, 0); |
30 pts[1].set(0, SkIntToScalar(100)); | 30 pts[1].set(0, SkIntToScalar(100)); |
31 colors[0] = SK_ColorBLACK; | 31 colors[0] = SK_ColorBLACK; |
32 colors[1] = SkColorSetARGB(0x80, 0, 0, 0); | 32 colors[1] = SkColorSetARGB(0x80, 0, 0, 0); |
33 SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, N
ULL, 2, | 33 SkAutoTUnref<SkShader> shaderB(SkGradientShader::CreateLinear(pts, colors, N
ULL, 2, |
34 SkShader::kCla
mp_TileMode)); | 34 SkShader::kCla
mp_TileMode)); |
35 | 35 |
36 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode)); | 36 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(mode)); |
37 | 37 |
38 return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, xfer)); | 38 return new SkComposeShader(shaderA, shaderB, xfer); |
39 } | 39 } |
40 | 40 |
41 class ComposeShaderGM : public skiagm::GM { | 41 class ComposeShaderGM : public skiagm::GM { |
42 public: | 42 public: |
43 ComposeShaderGM() { | 43 ComposeShaderGM() { |
44 fShader = make_shader(SkXfermode::kDstIn_Mode); | 44 fShader = make_shader(SkXfermode::kDstIn_Mode); |
45 } | 45 } |
46 | 46 |
47 virtual ~ComposeShaderGM() { | 47 virtual ~ComposeShaderGM() { |
48 SkSafeUnref(fShader); | 48 SkSafeUnref(fShader); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 canvas->restore(); | 114 canvas->restore(); |
115 canvas->translate(0, r.height() + 5); | 115 canvas->translate(0, r.height() + 5); |
116 } | 116 } |
117 } | 117 } |
118 }; | 118 }; |
119 | 119 |
120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
122 DEF_GM( return new ComposeShaderGM; ) | 122 DEF_GM( return new ComposeShaderGM; ) |
123 DEF_GM( return new ComposeShaderAlphaGM; ) | 123 DEF_GM( return new ComposeShaderAlphaGM; ) |
OLD | NEW |