OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 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 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 void fillPixels(int width, int height, void *pixels) { | 37 void fillPixels(int width, int height, void *pixels) { |
38 SkBitmap bmp; | 38 SkBitmap bmp; |
39 bmp.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType), wi
dth * 4); | 39 bmp.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType), wi
dth * 4); |
40 bmp.setPixels(pixels); | 40 bmp.setPixels(pixels); |
41 SkPaint paint; | 41 SkPaint paint; |
42 SkCanvas canvas(bmp); | 42 SkCanvas canvas(bmp); |
43 SkPoint pts[] = { {0, 0}, {0, SkIntToScalar(height)} }; | 43 SkPoint pts[] = { {0, 0}, {0, SkIntToScalar(height)} }; |
44 SkColor colors0[] = { 0xFF1060B0 , 0xFF102030 }; | 44 SkColor colors0[] = { 0xFF1060B0 , 0xFF102030 }; |
45 paint.setShader(SkGradientShader::MakeLinear(pts, colors0, nullptr, 2, | 45 paint.setShader(SkGradientShader::CreateLinear(pts, colors0, nullptr, 2, |
46 SkShader::kClamp_TileMode))
; | 46 SkShader::kClamp_TileMode
))->unref(); |
47 canvas.drawPaint(paint); | 47 canvas.drawPaint(paint); |
48 | 48 |
49 SkColor colors1[] = { 0xFFA07010 , 0xFFA02080 }; | 49 SkColor colors1[] = { 0xFFA07010 , 0xFFA02080 }; |
50 paint.setAntiAlias(true); | 50 paint.setAntiAlias(true); |
51 paint.setShader(SkGradientShader::MakeLinear(pts, colors1, nullptr, 2, | 51 paint.setShader(SkGradientShader::CreateLinear(pts, colors1, nullptr, 2, |
52 SkShader::kClamp_TileMode))
; | 52 SkShader::kClamp_TileMode
))->unref(); |
53 canvas.drawCircle(SkIntToScalar(width) / 2, SkIntToScalar(height) / 2, | 53 canvas.drawCircle(SkIntToScalar(width) / 2, SkIntToScalar(height) / 2, |
54 SkIntToScalar(width + height) / 5, paint); | 54 SkIntToScalar(width + height) / 5, paint); |
55 } | 55 } |
56 | 56 |
57 SkImage* createRectangleTextureImg(GrContext* context, int width, int height
, void* pixels) { | 57 SkImage* createRectangleTextureImg(GrContext* context, int width, int height
, void* pixels) { |
58 if (!context) { | 58 if (!context) { |
59 return nullptr; | 59 return nullptr; |
60 } | 60 } |
61 GrGpu* gpu = context->getGpu(); | 61 GrGpu* gpu = context->getGpu(); |
62 if (!gpu) { | 62 if (!gpu) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 private: | 184 private: |
185 typedef GM INHERITED; | 185 typedef GM INHERITED; |
186 }; | 186 }; |
187 | 187 |
188 DEF_GM(return new RectangleTexture;) | 188 DEF_GM(return new RectangleTexture;) |
189 } | 189 } |
190 | 190 |
191 #endif | 191 #endif |
OLD | NEW |