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

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 675823002: Fix the way we patch up the matrix for scaled images that aren't (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« gm/tiledscaledbitmap.cpp ('K') | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcState.cpp
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 2a449d6d8fa8e7732732bd9046517eb2a2ddb57d..69c5d7a2f3aa4794f3e6f90df3a299b214ddaf72 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -129,8 +129,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;
}
@@ -196,19 +194,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.
-
- float fractionalScaleX = roundedDestWidth/trueDestWidth;
- float fractionalScaleY = roundedDestHeight/trueDestHeight;
+ // clean up the inverse matrix by incorporating the scale we just performed.
- 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
@@ -372,8 +361,11 @@ 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());
+ // TODO(reed): The following conditional and matrix division could really use
+ // a comment!
+
+ if (!(clampClamp || trivialMatrix)) {
+ fInvMatrix.postIDiv(fBitmap->width(), fBitmap->height());
}
// Now that all possible changes to the matrix have taken place, check
« gm/tiledscaledbitmap.cpp ('K') | « gyp/gmslides.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698