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

Side by Side Diff: gm/rectangletexture.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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/pictureshadertile.cpp ('k') | gm/rects.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 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 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 24 matching lines...) Expand all
35 } 35 }
36 36
37 void fillPixels(int width, int height, void *pixels) { 37 void fillPixels(int width, int height, void *pixels) {
38 SkBitmap bmp; 38 SkBitmap bmp;
39 bmp.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType), wi dth * 4); 39 bmp.setInfo(SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType), wi dth * 4);
40 bmp.setPixels(pixels); 40 bmp.setPixels(pixels);
41 SkPaint paint; 41 SkPaint paint;
42 SkCanvas canvas(bmp); 42 SkCanvas canvas(bmp);
43 SkPoint pts[] = { {0, 0}, {0, SkIntToScalar(height)} }; 43 SkPoint pts[] = { {0, 0}, {0, SkIntToScalar(height)} };
44 SkColor colors0[] = { 0xFF1060B0 , 0xFF102030 }; 44 SkColor colors0[] = { 0xFF1060B0 , 0xFF102030 };
45 paint.setShader(SkGradientShader::CreateLinear(pts, colors0, nullptr, 2, 45 paint.setShader(SkGradientShader::MakeLinear(pts, colors0, nullptr, 2,
46 SkShader::kClamp_TileMode ))->unref(); 46 SkShader::kClamp_TileMode)) ;
47 canvas.drawPaint(paint); 47 canvas.drawPaint(paint);
48 48
49 SkColor colors1[] = { 0xFFA07010 , 0xFFA02080 }; 49 SkColor colors1[] = { 0xFFA07010 , 0xFFA02080 };
50 paint.setAntiAlias(true); 50 paint.setAntiAlias(true);
51 paint.setShader(SkGradientShader::CreateLinear(pts, colors1, nullptr, 2, 51 paint.setShader(SkGradientShader::MakeLinear(pts, colors1, nullptr, 2,
52 SkShader::kClamp_TileMode ))->unref(); 52 SkShader::kClamp_TileMode)) ;
53 canvas.drawCircle(SkIntToScalar(width) / 2, SkIntToScalar(height) / 2, 53 canvas.drawCircle(SkIntToScalar(width) / 2, SkIntToScalar(height) / 2,
54 SkIntToScalar(width + height) / 5, paint); 54 SkIntToScalar(width + height) / 5, paint);
55 } 55 }
56 56
57 SkImage* createRectangleTextureImg(GrContext* context, int width, int height , void* pixels) { 57 SkImage* createRectangleTextureImg(GrContext* context, int width, int height , void* pixels) {
58 if (!context) { 58 if (!context) {
59 return nullptr; 59 return nullptr;
60 } 60 }
61 GrGpu* gpu = context->getGpu(); 61 GrGpu* gpu = context->getGpu();
62 if (!gpu) { 62 if (!gpu) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 private: 184 private:
185 typedef GM INHERITED; 185 typedef GM INHERITED;
186 }; 186 };
187 187
188 DEF_GM(return new RectangleTexture;) 188 DEF_GM(return new RectangleTexture;)
189 } 189 }
190 190
191 #endif 191 #endif
OLDNEW
« no previous file with comments | « gm/pictureshadertile.cpp ('k') | gm/rects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698