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

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

Issue 1239193002: remove all guards for changes to drawBitmapRect / drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « src/core/SkCanvas.cpp ('k') | src/core/SkPictureRecord.h » ('j') | 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); 152 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
153 } 153 }
154 } 154 }
155 155
156 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src, 156 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const SkRect* src,
157 const SkRect& dst, const SkPaint& paint, 157 const SkRect& dst, const SkPaint& paint,
158 SkCanvas::SrcRectConstraint constraint) { 158 SkCanvas::SrcRectConstraint constraint) {
159 // Default impl : turns everything into raster bitmap 159 // Default impl : turns everything into raster bitmap
160 SkBitmap bm; 160 SkBitmap bm;
161 if (as_IB(image)->getROPixels(&bm)) { 161 if (as_IB(image)->getROPixels(&bm)) {
162 this->drawBitmapRect(draw, bm, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_T YPE)constraint); 162 this->drawBitmapRect(draw, bm, src, dst, paint, constraint);
163 } 163 }
164 } 164 }
165 165
166 void SkBaseDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect& center, 166 void SkBaseDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const SkIRect& center,
167 const SkRect& dst, const SkPaint& paint) { 167 const SkRect& dst, const SkPaint& paint) {
168 SkNinePatchIter iter(image->width(), image->height(), center, dst); 168 SkNinePatchIter iter(image->width(), image->height(), center, dst);
169 169
170 SkRect srcR, dstR; 170 SkRect srcR, dstR;
171 while (iter.next(&srcR, &dstR)) { 171 while (iter.next(&srcR, &dstR)) {
172 this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_S rcRectConstraint); 172 this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_S rcRectConstraint);
173 } 173 }
174 } 174 }
175 175
176 void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, co nst SkIRect& center, 176 void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, co nst SkIRect& center,
177 const SkRect& dst, const SkPaint& paint) { 177 const SkRect& dst, const SkPaint& paint) {
178 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst); 178 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst);
179 179
180 SkRect srcR, dstR; 180 SkRect srcR, dstR;
181 while (iter.next(&srcR, &dstR)) { 181 while (iter.next(&srcR, &dstR)) {
182 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, 182 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, SkCanvas::kStrict _SrcRectConstraint);
183 (SK_VIRTUAL_CONSTRAINT_TYPE)SkCanvas::kStrict_SrcRe ctConstraint);
184 } 183 }
185 } 184 }
186 185
187 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR SXform xform[], 186 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR SXform xform[],
188 const SkRect tex[], const SkColor colors[], int cou nt, 187 const SkRect tex[], const SkColor colors[], int cou nt,
189 SkXfermode::Mode mode, const SkPaint& paint) { 188 SkXfermode::Mode mode, const SkPaint& paint) {
190 SkPath path; 189 SkPath path;
191 path.setIsVolatile(true); 190 path.setIsVolatile(true);
192 191
193 for (int i = 0; i < count; ++i) { 192 for (int i = 0; i < count; ++i) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() 408 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
410 || this->onShouldDisableLCD(paint)) { 409 || this->onShouldDisableLCD(paint)) {
411 410
412 flags &= ~SkPaint::kLCDRenderText_Flag; 411 flags &= ~SkPaint::kLCDRenderText_Flag;
413 flags |= SkPaint::kGenA8FromLCD_Flag; 412 flags |= SkPaint::kGenA8FromLCD_Flag;
414 } 413 }
415 414
416 return flags; 415 return flags;
417 } 416 }
418 417
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698