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

Side by Side Diff: src/core/SkPictureShader.cpp

Issue 733203005: Tweak SkPictureShader's tile semantics. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« gm/pictureshadertile.cpp ('K') | « gm/pictureshadertile.cpp ('k') | no next file » | 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 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 "SkPictureShader.h" 8 #include "SkPictureShader.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) { 178 if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) {
179 SkBitmap bm; 179 SkBitmap bm;
180 bm.setInfo(SkImageInfo::MakeN32Premul(tileSize)); 180 bm.setInfo(SkImageInfo::MakeN32Premul(tileSize));
181 if (!cache_try_alloc_pixels(&bm)) { 181 if (!cache_try_alloc_pixels(&bm)) {
182 return NULL; 182 return NULL;
183 } 183 }
184 bm.eraseColor(SK_ColorTRANSPARENT); 184 bm.eraseColor(SK_ColorTRANSPARENT);
185 185
186 SkCanvas canvas(bm); 186 SkCanvas canvas(bm);
187 canvas.scale(tileScale.width(), tileScale.height()); 187 canvas.scale(tileScale.width(), tileScale.height());
188 canvas.translate(fTile.x(), fTile.y()); 188 canvas.translate(-fTile.x(), -fTile.y());
189 canvas.drawPicture(fPicture); 189 canvas.drawPicture(fPicture);
190 190
191 SkMatrix shaderMatrix = this->getLocalMatrix(); 191 SkMatrix shaderMatrix = this->getLocalMatrix();
192 shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height()); 192 shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height());
193 tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix)); 193 tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix));
194 194
195 SkResourceCache::Add(SkNEW_ARGS(BitmapShaderRec, (key, tileShader.get(), bm.getSize()))); 195 SkResourceCache::Add(SkNEW_ARGS(BitmapShaderRec, (key, tileShader.get(), bm.getSize())));
196 } 196 }
197 197
198 return tileShader.detach(); 198 return tileShader.detach();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 return bitmapShader->asFragmentProcessor(context, paint, NULL, paintColor, f p); 289 return bitmapShader->asFragmentProcessor(context, paint, NULL, paintColor, f p);
290 } 290 }
291 #else 291 #else
292 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*, 292 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix*, GrColor*,
293 GrFragmentProcessor**) const { 293 GrFragmentProcessor**) const {
294 SkDEBUGFAIL("Should not call in GPU-less build"); 294 SkDEBUGFAIL("Should not call in GPU-less build");
295 return false; 295 return false;
296 } 296 }
297 #endif 297 #endif
OLDNEW
« gm/pictureshadertile.cpp ('K') | « gm/pictureshadertile.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698