const SkBitmap& source,
ResizeMethod method,
float destWidth, float destHeight,
- const SkConvolutionProcs& convolveProcs,
SkBitmap::Allocator* allocator) {
+ SkConvolutionProcs convolveProcs= { 0, NULL, NULL, NULL, NULL };
+ PlatformConvolutionProcs(&convolveProcs);
+
SkRect destSubset = { 0, 0, destWidth, destHeight };
// Ensure that the ResizeMethod enumeration is sound.
SkErrorInternals::SetError( kInvalidArgument_SkError,
"Sorry, the destination bitmap scale subset "
"falls outside the full destination bitmap." );
+ return false;
}
// If the size of source or destination is 0, i.e. 0x0, 0xN or Nx0, just
*resultPtr = result;
resultPtr->lockPixels();
- SkASSERT(NULL != resultPtr->getPixels());
+ SkASSERT(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;
+}