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

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: uncomment setLocalMatrix 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 // TODO(dominikg): I think we either need to wrap these or create from s cratch each time.
144 fPictureShaders[tileMode]->setLocalMatrix(localMatrix); 145 fPictureShaders[tileMode]->setLocalMatrix(localMatrix);
145 paint.setShader(fPictureShaders[tileMode].get()); 146 paint.setShader(fPictureShaders[tileMode].get());
146 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 147 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
147 148
148 canvas->translate(fSceneSize * 1.1f, 0); 149 canvas->translate(fSceneSize * 1.1f, 0);
149 150
151 // TODO(dominikg): Same as above.
150 fBitmapShaders[tileMode]->setLocalMatrix(localMatrix); 152 fBitmapShaders[tileMode]->setLocalMatrix(localMatrix);
151 paint.setShader(fBitmapShaders[tileMode].get()); 153 paint.setShader(fBitmapShaders[tileMode].get());
152 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint); 154 canvas->drawRect(SkRect::MakeWH(fSceneSize, fSceneSize), paint);
153 155
154 canvas->restore(); 156 canvas->restore();
155 } 157 }
156 158
157 SkScalar fTileSize; 159 SkScalar fTileSize;
158 SkScalar fSceneSize; 160 SkScalar fSceneSize;
159 161
160 SkAutoTUnref<SkShader> fPictureShaders[SK_ARRAY_COUNT(kTileConfigs)]; 162 SkAutoTUnref<SkShader> fPictureShaders[SK_ARRAY_COUNT(kTileConfigs)];
161 SkAutoTUnref<SkShader> fBitmapShaders[SK_ARRAY_COUNT(kTileConfigs)]; 163 SkAutoTUnref<SkShader> fBitmapShaders[SK_ARRAY_COUNT(kTileConfigs)];
162 164
163 typedef GM INHERITED; 165 typedef GM INHERITED;
164 }; 166 };
165 167
166 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); ) 168 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); )
167 } 169 }
OLDNEW
« no previous file with comments | « gm/mixedxfermodes.cpp ('k') | gm/shaderbounds.cpp » ('j') | include/core/SkColorShader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698