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

Side by Side Diff: src/core/SkBitmapScaler.cpp

Issue 431613003: fix missing return in error case for bitmap scaler (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkBitmapScaler.h" 1 #include "SkBitmapScaler.h"
2 #include "SkBitmapFilter.h" 2 #include "SkBitmapFilter.h"
3 #include "SkRect.h" 3 #include "SkRect.h"
4 #include "SkTArray.h" 4 #include "SkTArray.h"
5 #include "SkErrorInternals.h" 5 #include "SkErrorInternals.h"
6 #include "SkConvolver.h" 6 #include "SkConvolver.h"
7 7
8 // SkResizeFilter -------------------------------------------------------------- -- 8 // SkResizeFilter -------------------------------------------------------------- --
9 9
10 // Encapsulates computation and storage of the filters required for one complete 10 // Encapsulates computation and storage of the filters required for one complete
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) && 257 SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) &&
258 (method <= RESIZE_LAST_QUALITY_METHOD)) || 258 (method <= RESIZE_LAST_QUALITY_METHOD)) ||
259 ((RESIZE_FIRST_ALGORITHM_METHOD <= method) && 259 ((RESIZE_FIRST_ALGORITHM_METHOD <= method) &&
260 (method <= RESIZE_LAST_ALGORITHM_METHOD))); 260 (method <= RESIZE_LAST_ALGORITHM_METHOD)));
261 261
262 SkRect dest = { 0, 0, destWidth, destHeight }; 262 SkRect dest = { 0, 0, destWidth, destHeight };
263 if (!dest.contains(destSubset)) { 263 if (!dest.contains(destSubset)) {
264 SkErrorInternals::SetError( kInvalidArgument_SkError, 264 SkErrorInternals::SetError( kInvalidArgument_SkError,
265 "Sorry, the destination bitmap scale subset " 265 "Sorry, the destination bitmap scale subset "
266 "falls outside the full destination bitmap." ); 266 "falls outside the full destination bitmap." );
267 return false;
267 } 268 }
268 269
269 // If the size of source or destination is 0, i.e. 0x0, 0xN or Nx0, just 270 // If the size of source or destination is 0, i.e. 0x0, 0xN or Nx0, just
270 // return empty. 271 // return empty.
271 if (source.width() < 1 || source.height() < 1 || 272 if (source.width() < 1 || source.height() < 1 ||
272 destWidth < 1 || destHeight < 1) { 273 destWidth < 1 || destHeight < 1) {
273 // todo: seems like we could handle negative dstWidth/Height, since that 274 // todo: seems like we could handle negative dstWidth/Height, since that
274 // is just a negative scale (flip) 275 // is just a negative scale (flip)
275 return false; 276 return false;
276 } 277 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 SkBitmap SkBitmapScaler::Resize(const SkBitmap& source, 324 SkBitmap SkBitmapScaler::Resize(const SkBitmap& source,
324 ResizeMethod method, 325 ResizeMethod method,
325 float destWidth, float destHeight, 326 float destWidth, float destHeight,
326 SkBitmap::Allocator* allocator) { 327 SkBitmap::Allocator* allocator) {
327 SkBitmap result; 328 SkBitmap result;
328 if (!Resize(&result, source, method, destWidth, destHeight, allocator)) { 329 if (!Resize(&result, source, method, destWidth, destHeight, allocator)) {
329 return SkBitmap(); 330 return SkBitmap();
330 } 331 }
331 return result; 332 return result;
332 } 333 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698