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

Side by Side Diff: gm/pictureshader.cpp

Issue 245963010: Move SkShader::fLocalMatrix into SkShader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add SkLocalMatrixShaderWrapper Created 6 years, 8 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 2014 Google Inc. 2 * Copyright 2014 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 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 SkPaint paint; 135 SkPaint paint;
136 paint.setStyle(SkPaint::kFill_Style); 136 paint.setStyle(SkPaint::kFill_Style);
137 paint.setColor(SK_ColorLTGRAY); 137 paint.setColor(SK_ColorLTGRAY);
138 138
139 canvas->save(); 139 canvas->save();
140 canvas->concat(matrix); 140 canvas->concat(matrix);
141 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 141 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
142 canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSce neSize), paint); 142 canvas->drawRect(SkRect::MakeXYWH(fSceneSize * 1.1f, 0, fSceneSize, fSce neSize), paint);
143 143
144 fPictureShaders[tileMode]->setLocalMatrix(localMatrix); 144 paint.setShader(SkShader::CreateLocalMatrixWrapper(fPictureShaders[tileM ode].get(),
145 paint.setShader(fPictureShaders[tileMode].get()); 145 localMatrix));
146 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 146 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
147 147
148 canvas->translate(fSceneSize * 1.1f, 0); 148 canvas->translate(fSceneSize * 1.1f, 0);
149 149
150 fBitmapShaders[tileMode]->setLocalMatrix(localMatrix); 150 paint.setShader(SkShader::CreateLocalMatrixWrapper(fBitmapShaders[tileMo de].get(),
151 paint.setShader(fBitmapShaders[tileMode].get()); 151 localMatrix));
152 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 152 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
153 153
154 canvas->restore(); 154 canvas->restore();
155 } 155 }
156 156
157 SkScalar fTileSize; 157 SkScalar fTileSize;
158 SkScalar fSceneSize; 158 SkScalar fSceneSize;
159 159
160 SkAutoTUnref<SkShader> fPictureShaders[SK_ARRAY_COUNT(kTileConfigs)]; 160 SkAutoTUnref<SkShader> fPictureShaders[SK_ARRAY_COUNT(kTileConfigs)];
161 SkAutoTUnref<SkShader> fBitmapShaders[SK_ARRAY_COUNT(kTileConfigs)]; 161 SkAutoTUnref<SkShader> fBitmapShaders[SK_ARRAY_COUNT(kTileConfigs)];
162 162
163 typedef GM INHERITED; 163 typedef GM INHERITED;
164 }; 164 };
165 165
166 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); ) 166 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); )
167 } 167 }
OLDNEW
« no previous file with comments | « gm/mixedxfermodes.cpp ('k') | gm/shaderbounds.cpp » ('j') | include/core/SkShader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698