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

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

Issue 354193002: Refactor bitmap scaler to make it easier to migrate rest of chrome to use it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « src/core/SkBitmapScaler.h ('k') | src/opts/SkBitmapProcState_opts_arm.cpp » ('j') | 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return SkBitmapScaler::RESIZE_MITCHELL; 239 return SkBitmapScaler::RESIZE_MITCHELL;
240 #endif 240 #endif
241 } 241 }
242 } 242 }
243 243
244 // static 244 // static
245 bool SkBitmapScaler::Resize(SkBitmap* resultPtr, 245 bool SkBitmapScaler::Resize(SkBitmap* resultPtr,
246 const SkBitmap& source, 246 const SkBitmap& source,
247 ResizeMethod method, 247 ResizeMethod method,
248 float destWidth, float destHeight, 248 float destWidth, float destHeight,
249 const SkConvolutionProcs& convolveProcs,
250 SkBitmap::Allocator* allocator) { 249 SkBitmap::Allocator* allocator) {
251 250
251 SkConvolutionProcs convolveProcs= { 0, NULL, NULL, NULL, NULL };
252 PlatformConvolutionProcs(&convolveProcs);
253
252 SkRect destSubset = { 0, 0, destWidth, destHeight }; 254 SkRect destSubset = { 0, 0, destWidth, destHeight };
253 255
254 // Ensure that the ResizeMethod enumeration is sound. 256 // Ensure that the ResizeMethod enumeration is sound.
255 SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) && 257 SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) &&
256 (method <= RESIZE_LAST_QUALITY_METHOD)) || 258 (method <= RESIZE_LAST_QUALITY_METHOD)) ||
257 ((RESIZE_FIRST_ALGORITHM_METHOD <= method) && 259 ((RESIZE_FIRST_ALGORITHM_METHOD <= method) &&
258 (method <= RESIZE_LAST_ALGORITHM_METHOD))); 260 (method <= RESIZE_LAST_ALGORITHM_METHOD)));
259 261
260 SkRect dest = { 0, 0, destWidth, destHeight }; 262 SkRect dest = { 0, 0, destWidth, destHeight };
261 if (!dest.contains(destSubset)) { 263 if (!dest.contains(destSubset)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 !source.isOpaque(), filter.xFilter(), filter.yFilter(), 310 !source.isOpaque(), filter.xFilter(), filter.yFilter(),
309 static_cast<int>(result.rowBytes()), 311 static_cast<int>(result.rowBytes()),
310 static_cast<unsigned char*>(result.getPixels()), 312 static_cast<unsigned char*>(result.getPixels()),
311 convolveProcs, true); 313 convolveProcs, true);
312 314
313 *resultPtr = result; 315 *resultPtr = result;
314 resultPtr->lockPixels(); 316 resultPtr->lockPixels();
315 SkASSERT(NULL != resultPtr->getPixels()); 317 SkASSERT(NULL != resultPtr->getPixels());
316 return true; 318 return true;
317 } 319 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapScaler.h ('k') | src/opts/SkBitmapProcState_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698