OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 22 matching lines...) Expand all Loading... |
33 SkISize onISize() override { | 33 SkISize onISize() override { |
34 return SkISize::Make(50, 135); | 34 return SkISize::Make(50, 135); |
35 } | 35 } |
36 | 36 |
37 void onOnceBeforeDraw() override { | 37 void onOnceBeforeDraw() override { |
38 // We create an RGB bitmap and then extract YUV bmps where the U and V b
itmaps are | 38 // We create an RGB bitmap and then extract YUV bmps where the U and V b
itmaps are |
39 // subsampled by 2 in both dimensions. | 39 // subsampled by 2 in both dimensions. |
40 SkPaint paint; | 40 SkPaint paint; |
41 static const SkColor kColors[] = | 41 static const SkColor kColors[] = |
42 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; | 42 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; |
43 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(0,0), kBmpSiz
e / 2.f, kColors, | 43 paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), kBmpS
ize / 2.f, kColors, |
44 nullptr, SK_ARRAY_COUNT(kCo
lors), | 44 nullptr, SK_ARRAY_COUNT(k
Colors), |
45 SkShader::kMirror_TileMode)
); | 45 SkShader::kMirror_TileMod
e))->unref(); |
46 SkBitmap rgbBmp; | 46 SkBitmap rgbBmp; |
47 rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true); | 47 rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true); |
48 SkCanvas canvas(rgbBmp); | 48 SkCanvas canvas(rgbBmp); |
49 canvas.drawPaint(paint); | 49 canvas.drawPaint(paint); |
50 SkPMColor* rgbColors = static_cast<SkPMColor*>(rgbBmp.getPixels()); | 50 SkPMColor* rgbColors = static_cast<SkPMColor*>(rgbBmp.getPixels()); |
51 | 51 |
52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize); | 52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize); |
53 fYUVBmps[0].allocPixels(yinfo); | 53 fYUVBmps[0].allocPixels(yinfo); |
54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); | 54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); |
55 fYUVBmps[1].allocPixels(uinfo); | 55 fYUVBmps[1].allocPixels(uinfo); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 static const int kBmpSize = 32; | 167 static const int kBmpSize = 32; |
168 | 168 |
169 typedef GM INHERITED; | 169 typedef GM INHERITED; |
170 }; | 170 }; |
171 | 171 |
172 DEF_GM(return new ImageFromYUVTextures;) | 172 DEF_GM(return new ImageFromYUVTextures;) |
173 } | 173 } |
174 | 174 |
175 #endif | 175 #endif |
OLD | NEW |