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

Unified Diff: src/core/SkDraw.cpp

Issue 1569873003: Revert of SkTreatAsSprite should take AA into account (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: 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 246c31ba5102a114fa51c7a67e0559a852628ab6..249795d0d15dbb3169cd49a381e89af5948ca4d9 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1172,11 +1172,20 @@
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 (SkTreatAsSprite(*fMatrix, bitmap.dimensions(), paint)) {
+ if (just_translate(*fMatrix, bitmap)) {
int ix = SkScalarRoundToInt(fMatrix->getTranslateX());
int iy = SkScalarRoundToInt(fMatrix->getTranslateY());
@@ -1291,8 +1300,7 @@
return;
}
- if (bitmap.colorType() != kAlpha_8_SkColorType
- && SkTreatAsSprite(matrix, bitmap.dimensions(), paint)) {
+ if (bitmap.colorType() != kAlpha_8_SkColorType && just_translate(matrix, bitmap)) {
//
// 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