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" |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 #include "SkImage.h" | 13 #include "SkImage.h" |
14 | 14 |
15 static SkImage* create_image(GrContext* context, int width, int height) { | 15 static SkImage* create_image(GrContext* context, int width, int height) { |
16 SkAutoTUnref<SkSurface> surface; | 16 SkAutoTUnref<SkSurface> surface; |
17 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 17 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
18 if (context) { | 18 if (context) { |
19 surface.reset(SkSurface::NewRenderTarget(context, SkSurface::kYes_Budge
ted, info, 0)); | 19 surface.reset(SkSurface::NewRenderTarget(context, SkBudgeted::kYes, inf
o, 0)); |
20 } else { | 20 } else { |
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 }; |
(...skipping 72 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 |