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

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

Issue 1298233003: handle no shader from image in drawAtlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | 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 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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 for (int i = 0; i < count; ++i) { 192 for (int i = 0; i < count; ++i) {
193 SkPoint quad[4]; 193 SkPoint quad[4];
194 xform[i].toQuad(tex[i].width(), tex[i].height(), quad); 194 xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
195 195
196 SkMatrix localM; 196 SkMatrix localM;
197 localM.setRSXform(xform[i]); 197 localM.setRSXform(xform[i]);
198 localM.preTranslate(-tex[i].left(), -tex[i].top()); 198 localM.preTranslate(-tex[i].left(), -tex[i].top());
199 199
200 SkPaint pnt(paint); 200 SkPaint pnt(paint);
201 pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kCla mp_TileMode, 201 SkAutoTUnref<SkShader> shader(atlas->newShader(SkShader::kClamp_TileMode ,
202 &localM))->unref(); 202 SkShader::kClamp_TileMode ,
203 &localM));
204 if (!shader) {
205 break;
206 }
207 pnt.setShader(shader);
208
203 if (colors && colors[i] != SK_ColorWHITE) { 209 if (colors && colors[i] != SK_ColorWHITE) {
204 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(color s[i], mode)); 210 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(color s[i], mode));
205 pnt.setColorFilter(cf); 211 pnt.setColorFilter(cf);
206 } 212 }
207 213
208 path.rewind(); 214 path.rewind();
209 path.addPoly(quad, 4, true); 215 path.addPoly(quad, 4, true);
210 path.setConvexity(SkPath::kConvex_Convexity); 216 path.setConvexity(SkPath::kConvex_Convexity);
211 this->drawPath(draw, path, pnt, NULL, true); 217 this->drawPath(draw, path, pnt, NULL, true);
212 } 218 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() 414 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
409 || this->onShouldDisableLCD(paint)) { 415 || this->onShouldDisableLCD(paint)) {
410 416
411 flags &= ~SkPaint::kLCDRenderText_Flag; 417 flags &= ~SkPaint::kLCDRenderText_Flag;
412 flags |= SkPaint::kGenA8FromLCD_Flag; 418 flags |= SkPaint::kGenA8FromLCD_Flag;
413 } 419 }
414 420
415 return flags; 421 return flags;
416 } 422 }
417 423
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698