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

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

Issue 301283003: Revert "Revert of setConfig -> setInfo (https://codereview.chromium.org/308683005/)" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add guard for android 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkCanvas.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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 destWidth, destHeight, destSubset, convolveProcs); 289 destWidth, destHeight, destSubset, convolveProcs);
290 290
291 // Get a source bitmap encompassing this touched area. We construct the 291 // Get a source bitmap encompassing this touched area. We construct the
292 // offsets and row strides such that it looks like a new bitmap, while 292 // offsets and row strides such that it looks like a new bitmap, while
293 // referring to the old data. 293 // referring to the old data.
294 const unsigned char* sourceSubset = 294 const unsigned char* sourceSubset =
295 reinterpret_cast<const unsigned char*>(source.getPixels()); 295 reinterpret_cast<const unsigned char*>(source.getPixels());
296 296
297 // Convolve into the result. 297 // Convolve into the result.
298 SkBitmap result; 298 SkBitmap result;
299 result.setConfig(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()), 299 result.setInfo(SkImageInfo::MakeN32(SkScalarCeilToInt(destSubset.width()),
300 SkScalarCeilToInt(destSubset.height()) , 300 SkScalarCeilToInt(destSubset.height()),
301 source.alphaType())); 301 source.alphaType()));
302 result.allocPixels(allocator, NULL); 302 result.allocPixels(allocator, NULL);
303 if (!result.readyToDraw()) { 303 if (!result.readyToDraw()) {
304 return false; 304 return false;
305 } 305 }
306 306
307 BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()), 307 BGRAConvolve2D(sourceSubset, static_cast<int>(source.rowBytes()),
308 !source.isOpaque(), filter.xFilter(), filter.yFilter(), 308 !source.isOpaque(), filter.xFilter(), filter.yFilter(),
309 static_cast<int>(result.rowBytes()), 309 static_cast<int>(result.rowBytes()),
310 static_cast<unsigned char*>(result.getPixels()), 310 static_cast<unsigned char*>(result.getPixels()),
311 convolveProcs, true); 311 convolveProcs, true);
312 312
313 *resultPtr = result; 313 *resultPtr = result;
314 resultPtr->lockPixels(); 314 resultPtr->lockPixels();
315 SkASSERT(NULL != resultPtr->getPixels()); 315 SkASSERT(NULL != resultPtr->getPixels());
316 return true; 316 return true;
317 } 317 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698