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

Side by Side Diff: gm/aarectmodes.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 6 years, 7 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 | « no previous file | gm/bigmatrix.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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return H; 106 return H;
107 } 107 }
108 108
109 static SkShader* make_bg_shader() { 109 static SkShader* make_bg_shader() {
110 SkBitmap bm; 110 SkBitmap bm;
111 bm.allocN32Pixels(2, 2); 111 bm.allocN32Pixels(2, 2);
112 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; 112 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
113 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 113 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC,
114 0xCC, 0xCC); 114 0xCC, 0xCC);
115 115
116 SkMatrix m;
117 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
116 SkShader* s = SkShader::CreateBitmapShader(bm, 118 SkShader* s = SkShader::CreateBitmapShader(bm,
117 SkShader::kRepeat_TileMode, 119 SkShader::kRepeat_TileMode,
118 SkShader::kRepeat_TileMode); 120 SkShader::kRepeat_TileMode,
121 &m);
119 122
120 SkMatrix m;
121 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
122 s->setLocalMatrix(m);
123 return s; 123 return s;
124 } 124 }
125 125
126 namespace skiagm { 126 namespace skiagm {
127 127
128 class AARectModesGM : public GM { 128 class AARectModesGM : public GM {
129 SkPaint fBGPaint; 129 SkPaint fBGPaint;
130 public: 130 public:
131 AARectModesGM () { 131 AARectModesGM () {
132 fBGPaint.setShader(make_bg_shader())->unref(); 132 fBGPaint.setShader(make_bg_shader())->unref();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 private: 179 private:
180 typedef GM INHERITED; 180 typedef GM INHERITED;
181 }; 181 };
182 182
183 ////////////////////////////////////////////////////////////////////////////// 183 //////////////////////////////////////////////////////////////////////////////
184 184
185 static GM* MyFactory(void*) { return new AARectModesGM; } 185 static GM* MyFactory(void*) { return new AARectModesGM; }
186 static GMRegistry reg(MyFactory); 186 static GMRegistry reg(MyFactory);
187 187
188 } 188 }
OLDNEW
« no previous file with comments | « no previous file | gm/bigmatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698