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

Side by Side Diff: gm/imagetoyuvplanes.cpp

Issue 1789633002: more shader-->sp conversions (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
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"
(...skipping 10 matching lines...) Expand all
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::CreateRadial(SkPoint::Make(0,0), r, kColor s, 31 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(0,0), r, kColors,
32 nullptr, SK_ARRAY_COUNT(kColo rs), 32 nullptr, SK_ARRAY_COUNT(kColors ),
33 SkShader::kMirror_TileMode))- >unref(); 33 SkShader::kMirror_TileMode));
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
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/imagefromyuvtextures.cpp ('k') | gm/lcdblendmodes.cpp » ('j') | gm/pictureshadertile.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698