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

Unified Diff: src/core/SkBitmapScaler.cpp

Issue 353163005: add a second interface to the resizer to exactly match what Chrome expects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/SkBitmapScaler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapScaler.cpp
diff --git a/src/core/SkBitmapScaler.cpp b/src/core/SkBitmapScaler.cpp
index 35e101efa964238f7f05a13de849d396a636d759..aaee600c8f8650dff77582d9cfdea3168b53c901 100644
--- a/src/core/SkBitmapScaler.cpp
+++ b/src/core/SkBitmapScaler.cpp
@@ -317,3 +317,16 @@ bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
SkASSERT(NULL != resultPtr->getPixels());
return true;
}
+
+// static -- simpler interface to the resizer; returns a default bitmap if scaling
+// fails for any reason. This is the interface that Chrome expects.
+SkBitmap SkBitmapScaler::Resize(const SkBitmap& source,
+ ResizeMethod method,
+ float destWidth, float destHeight,
+ SkBitmap::Allocator* allocator) {
+ SkBitmap result;
+ if (!Resize(&result, source, method, destWidth, destHeight, allocator)) {
+ return SkBitmap();
+ }
+ return result;
+}
« no previous file with comments | « src/core/SkBitmapScaler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698