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

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

Issue 26973006: catch the other case where we need to see if fScaledBitmap.lockPixels() might have failed (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | « 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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBitmapProcState.h" 8 #include "SkBitmapProcState.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFilterProc.h" 10 #include "SkFilterProc.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, 292 fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap,
293 SK_Scalar1, SK_Scala r1, 293 SK_Scalar1, SK_Scala r1,
294 fScaledBitmap); 294 fScaledBitmap);
295 if (!fScaledCacheID) { 295 if (!fScaledCacheID) {
296 fScaledBitmap.reset(); 296 fScaledBitmap.reset();
297 return false; 297 return false;
298 } 298 }
299 } 299 }
300 } 300 }
301 fScaledBitmap.lockPixels(); // just 'cause the cache made a copy :( 301 fScaledBitmap.lockPixels(); // just 'cause the cache made a copy :(
302 if (!fScaledBitmap.getPixels()) {
303 // TODO: find out how this can happen, and add a unittest to exercise
304 // inspired by BUG=chromium:295895
305 return false;
306 }
302 fBitmap = &fScaledBitmap; 307 fBitmap = &fScaledBitmap;
303 return true; 308 return true;
304 } 309 }
305 310
306 void SkBitmapProcState::endContext() { 311 void SkBitmapProcState::endContext() {
307 SkDELETE(fBitmapFilter); 312 SkDELETE(fBitmapFilter);
308 fBitmapFilter = NULL; 313 fBitmapFilter = NULL;
309 fScaledBitmap.reset(); 314 fScaledBitmap.reset();
310 315
311 if (fScaledCacheID) { 316 if (fScaledCacheID) {
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 } else { 979 } else {
975 size >>= 2; 980 size >>= 2;
976 } 981 }
977 982
978 if (fFilterLevel != SkPaint::kNone_FilterLevel) { 983 if (fFilterLevel != SkPaint::kNone_FilterLevel) {
979 size >>= 1; 984 size >>= 1;
980 } 985 }
981 986
982 return size; 987 return size;
983 } 988 }
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