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

Side by Side Diff: gm/drawminibitmaprect.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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/drawbitmaprect.cpp ('k') | gm/filltypespersp.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 2015 Google Inc. 2 * Copyright 2015 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 #include "gm.h" 8 #include "gm.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 28 matching lines...) Expand all
39 3 * SK_Scalar1 / 6, 39 3 * SK_Scalar1 / 6,
40 4 * SK_Scalar1 / 6, 40 4 * SK_Scalar1 / 6,
41 5 * SK_Scalar1 / 6, 41 5 * SK_Scalar1 / 6,
42 SK_Scalar1}; 42 SK_Scalar1};
43 43
44 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos)); 44 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos));
45 SkPaint paint; 45 SkPaint paint;
46 SkRect rect = SkRect::MakeWH(wScalar, hScalar); 46 SkRect rect = SkRect::MakeWH(wScalar, hScalar);
47 SkMatrix mat = SkMatrix::I(); 47 SkMatrix mat = SkMatrix::I();
48 for (int i = 0; i < 4; ++i) { 48 for (int i = 0; i < 4; ++i) {
49 paint.setShader(SkGradientShader::CreateRadial( 49 paint.setShader(SkGradientShader::MakeRadial(
50 pt, radius, 50 pt, radius,
51 colors, pos, 51 colors, pos,
52 SK_ARRAY_COUNT(colors), 52 SK_ARRAY_COUNT(colors),
53 SkShader::kRepeat_TileMode, 53 SkShader::kRepeat_TileMode,
54 0, &mat))->unref(); 54 0, &mat));
55 canvas->drawRect(rect, paint); 55 canvas->drawRect(rect, paint);
56 rect.inset(wScalar / 8, hScalar / 8); 56 rect.inset(wScalar / 8, hScalar / 8);
57 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); 57 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4);
58 } 58 }
59 return surface->newImageSnapshot(); 59 return surface->newImageSnapshot();
60 } 60 }
61 61
62 static const int gSize = 1024; 62 static const int gSize = 1024;
63 static const int gSurfaceSize = 2048; 63 static const int gSurfaceSize = 2048;
64 64
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool fAA; 134 bool fAA;
135 SkAutoTUnref<SkImage> fImage; 135 SkAutoTUnref<SkImage> fImage;
136 SkString fName; 136 SkString fName;
137 137
138 typedef skiagm::GM INHERITED; 138 typedef skiagm::GM INHERITED;
139 }; 139 };
140 140
141 DEF_GM( return new DrawMiniBitmapRectGM(true); ) 141 DEF_GM( return new DrawMiniBitmapRectGM(true); )
142 DEF_GM( return new DrawMiniBitmapRectGM(false); ) 142 DEF_GM( return new DrawMiniBitmapRectGM(false); )
143 143
OLDNEW
« no previous file with comments | « gm/drawbitmaprect.cpp ('k') | gm/filltypespersp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698