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

Unified Diff: src/core/SkBitmapProcState.cpp

Issue 307553005: floating point scale factors for images (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove the box; it landed separately Created 6 years, 7 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 | « gyp/gmslides.gypi ('k') | src/core/SkBitmapScaler.h » ('j') | 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 eecfbbcc483c67e42e99c3dfd85bd8b9e2855b7b..220eb56316eacf4c6a532aceea89c5943d27b9f8 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -15,6 +15,7 @@
#include "SkMipMap.h"
#include "SkPixelRef.h"
#include "SkScaledImageCache.h"
+#include "SkImageEncoder.h"
#if !SK_ARM_NEON_IS_NONE
// These are defined in src/opts/SkBitmapProcState_arm_neon.cpp
@@ -166,8 +167,13 @@ bool SkBitmapProcState::possiblyScaleImage() {
}
if (NULL == fScaledCacheID) {
- int dest_width = SkScalarCeilToInt(fOrigBitmap.width() / invScaleX);
- int dest_height = SkScalarCeilToInt(fOrigBitmap.height() / invScaleY);
+ float dest_width = fOrigBitmap.width() / invScaleX;
+ float dest_height = fOrigBitmap.height() / invScaleY;
+
+#ifdef SK_IGNORE_CORRECT_HIGH_QUALITY_IMAGE_SCALE
+ dest_width = SkScalarCeilToScalar(dest_width);
+ dest_height = SkScalarCeilToScalar(dest_height);
+#endif
// All the criteria are met; let's make a new bitmap.
@@ -187,6 +193,7 @@ bool SkBitmapProcState::possiblyScaleImage() {
return false;
}
+
SkASSERT(NULL != fScaledBitmap.getPixels());
fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap,
invScaleX,
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/core/SkBitmapScaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698