OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 | 8 |
9 #include <SkSurface.h> | 9 #include <SkSurface.h> |
10 #include "gm.h" | 10 #include "gm.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 surface.reset(SkSurface::NewRaster(info)); | 21 surface.reset(SkSurface::NewRaster(info)); |
22 } | 22 } |
23 if (!surface) { | 23 if (!surface) { |
24 return nullptr; | 24 return nullptr; |
25 } | 25 } |
26 // Create an RGB image from which we will extract planes | 26 // Create an RGB image from which we will extract planes |
27 SkPaint paint; | 27 SkPaint paint; |
28 static const SkColor kColors[] = | 28 static const SkColor kColors[] = |
29 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; | 29 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; |
30 SkScalar r = (width + height) / 4.f; | 30 SkScalar r = (width + height) / 4.f; |
31 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(0,0), r, kColors, | 31 paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), r, kColor
s, |
32 nullptr, SK_ARRAY_COUNT(kColors
), | 32 nullptr, SK_ARRAY_COUNT(kColo
rs), |
33 SkShader::kMirror_TileMode)); | 33 SkShader::kMirror_TileMode))-
>unref(); |
34 | 34 |
35 surface->getCanvas()->drawPaint(paint); | 35 surface->getCanvas()->drawPaint(paint); |
36 return surface->newImageSnapshot(); | 36 return surface->newImageSnapshot(); |
37 } | 37 } |
38 | 38 |
39 DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) { | 39 DEF_SIMPLE_GM(image_to_yuv_planes, canvas, 120, 525) { |
40 static const SkScalar kPad = 5.f; | 40 static const SkScalar kPad = 5.f; |
41 static const int kImageSize = 32; | 41 static const int kImageSize = 32; |
42 | 42 |
43 GrContext *context = canvas->getGrContext(); | 43 GrContext *context = canvas->getGrContext(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 for (int i = 0; i < 3; ++i) { | 102 for (int i = 0; i < 3; ++i) { |
103 canvas->drawBitmap(yuvBmps[i], x, y); | 103 canvas->drawBitmap(yuvBmps[i], x, y); |
104 y += kPad + yuvBmps[i].height(); | 104 y += kPad + yuvBmps[i].height(); |
105 } | 105 } |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 x += rgbImage->width() + kPad; | 109 x += rgbImage->width() + kPad; |
110 } | 110 } |
111 } | 111 } |
OLD | NEW |