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

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

Issue 884163003: Disable LCD text when rasterizing SkPictureShader tiles. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 10 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 | « include/core/SkCanvas.h ('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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 this->getLocalMatrix()); 187 this->getLocalMatrix());
188 188
189 if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) { 189 if (!SkResourceCache::Find(key, BitmapShaderRec::Visitor, &tileShader)) {
190 SkBitmap bm; 190 SkBitmap bm;
191 bm.setInfo(SkImageInfo::MakeN32Premul(tileSize)); 191 bm.setInfo(SkImageInfo::MakeN32Premul(tileSize));
192 if (!cache_try_alloc_pixels(&bm)) { 192 if (!cache_try_alloc_pixels(&bm)) {
193 return NULL; 193 return NULL;
194 } 194 }
195 bm.eraseColor(SK_ColorTRANSPARENT); 195 bm.eraseColor(SK_ColorTRANSPARENT);
196 196
197 SkCanvas canvas(bm); 197 // Always disable LCD text, since we can't assume our image will be opaq ue.
198 SkCanvas canvas(bm, SkSurfaceProps(0, kUnknown_SkPixelGeometry));
199
198 canvas.scale(tileScale.width(), tileScale.height()); 200 canvas.scale(tileScale.width(), tileScale.height());
199 canvas.translate(-fTile.x(), -fTile.y()); 201 canvas.translate(-fTile.x(), -fTile.y());
200 canvas.drawPicture(fPicture); 202 canvas.drawPicture(fPicture);
201 203
202 SkMatrix shaderMatrix = this->getLocalMatrix(); 204 SkMatrix shaderMatrix = this->getLocalMatrix();
203 shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height()); 205 shaderMatrix.preScale(1 / tileScale.width(), 1 / tileScale.height());
204 tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix)); 206 tileShader.reset(CreateBitmapShader(bm, fTmx, fTmy, &shaderMatrix));
205 207
206 SkResourceCache::Add(SkNEW_ARGS(BitmapShaderRec, (key, tileShader.get(), bm.getSize()))); 208 SkResourceCache::Add(SkNEW_ARGS(BitmapShaderRec, (key, tileShader.get(), bm.getSize())));
207 } 209 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC olor, fp); 307 return bitmapShader->asFragmentProcessor(context, paint, viewM, NULL, paintC olor, fp);
306 } 308 }
307 #else 309 #else
308 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&, 310 bool SkPictureShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMa trix&,
309 const SkMatrix*, GrColor*, 311 const SkMatrix*, GrColor*,
310 GrFragmentProcessor**) const { 312 GrFragmentProcessor**) const {
311 SkDEBUGFAIL("Should not call in GPU-less build"); 313 SkDEBUGFAIL("Should not call in GPU-less build");
312 return false; 314 return false;
313 } 315 }
314 #endif 316 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698