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

Unified Diff: src/core/SkDraw.cpp

Issue 1566943002: SkTreatAsSprite should take AA into account (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: SkLeftShift Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 249795d0d15dbb3169cd49a381e89af5948ca4d9..246c31ba5102a114fa51c7a67e0559a852628ab6 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1172,20 +1172,11 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint,
proc(*devPathPtr, *fRC, blitter);
}
-/** For the purposes of drawing bitmaps, if a matrix is "almost" translate
- go ahead and treat it as if it were, so that subsequent code can go fast.
- */
-static bool just_translate(const SkMatrix& matrix, const SkBitmap& bitmap) {
- unsigned bits = 0; // TODO: find a way to allow the caller to tell us to
- // respect filtering.
- return SkTreatAsSprite(matrix, bitmap.width(), bitmap.height(), bits);
-}
-
void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap,
const SkPaint& paint) const {
SkASSERT(bitmap.colorType() == kAlpha_8_SkColorType);
- if (just_translate(*fMatrix, bitmap)) {
+ if (SkTreatAsSprite(*fMatrix, bitmap.dimensions(), paint)) {
int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
@@ -1300,7 +1291,8 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
return;
}
- if (bitmap.colorType() != kAlpha_8_SkColorType && just_translate(matrix, bitmap)) {
+ if (bitmap.colorType() != kAlpha_8_SkColorType
+ && SkTreatAsSprite(matrix, bitmap.dimensions(), paint)) {
//
// It is safe to call lock pixels now, since we know the matrix is
// (more or less) identity.
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698