Index: src/core/SkBitmapProcState.cpp |
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp |
index b1b50b0c329af9eb727f5710353fb742b1c075d7..656e0c4ca0b2fca68fb3c5624104adba113f2146 100644 |
--- a/src/core/SkBitmapProcState.cpp |
+++ b/src/core/SkBitmapProcState.cpp |
@@ -131,8 +131,6 @@ static inline bool cache_size_okay(const SkBitmap& bm, const SkMatrix& invMat) { |
bool SkBitmapProcState::possiblyScaleImage() { |
SkASSERT(NULL == fBitmap); |
- fAdjustedMatrix = false; |
- |
if (fFilterLevel <= SkPaint::kLow_FilterLevel) { |
return false; |
} |
@@ -198,19 +196,10 @@ bool SkBitmapProcState::possiblyScaleImage() { |
SkASSERT(fScaledBitmap.getPixels()); |
fBitmap = &fScaledBitmap; |
- // set the inv matrix type to translate-only; |
- fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScaleX(), |
- fInvMatrix.getTranslateY() / fInvMatrix.getScaleY()); |
- |
-#ifndef SK_IGNORE_PROPER_FRACTIONAL_SCALING |
- // reintroduce any fractional scaling missed by our integral scale done above. |
+ // clean up the inverse matrix by incorporating the scale we just performed. |
- float fractionalScaleX = roundedDestWidth/trueDestWidth; |
- float fractionalScaleY = roundedDestHeight/trueDestHeight; |
- |
- fInvMatrix.postScale(fractionalScaleX, fractionalScaleY); |
-#endif |
- fAdjustedMatrix = true; |
+ fInvMatrix.postScale(roundedDestWidth / fOrigBitmap.width(), |
+ roundedDestHeight / fOrigBitmap.height()); |
// Set our filter level to low -- the only post-filtering this |
// image might require is some interpolation if the translation |
@@ -374,8 +363,15 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { |
bool clampClamp = SkShader::kClamp_TileMode == fTileModeX && |
SkShader::kClamp_TileMode == fTileModeY; |
- if (!(fAdjustedMatrix || clampClamp || trivialMatrix)) { |
- fInvMatrix.postIDiv(fOrigBitmap.width(), fOrigBitmap.height()); |
+ // Most of the scanline procs deal with "unit" texture coordinates, as this |
+ // makes it easy to perform tiling modes (repeat = (x & 0xFFFF)). To generate |
+ // those, we divide the matrix by its dimensions here. |
+ // |
+ // We don't do this if we're either trivial (can ignore the matrix) or clamping |
+ // in both X and Y since clamping to width,height is just as easy as to 0xFFFF. |
+ |
+ if (!(clampClamp || trivialMatrix)) { |
+ fInvMatrix.postIDiv(fBitmap->width(), fBitmap->height()); |
} |
// Now that all possible changes to the matrix have taken place, check |