Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: gm/imagetoyuvplanes.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/imagesource2.cpp ('k') | gm/lcdblendmodes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 sk_sp<SkImage> create_image(GrContext* context, int width, int height) { 15 static sk_sp<SkImage> create_image(GrContext* context, int width, int height) {
16 SkAutoTUnref<SkSurface> surface; 16 sk_sp<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, SkBudgeted::kYes, inf o, 0)); 19 surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info);
20 } else { 20 } else {
21 surface.reset(SkSurface::NewRaster(info)); 21 surface = SkSurface::MakeRaster(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::MakeRadial(SkPoint::Make(0,0), r, kColors,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « gm/imagesource2.cpp ('k') | gm/lcdblendmodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698