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

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

Issue 1142343010: add assert that the pixelref really did success in requestlock (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« 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 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
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 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 SkASSERT(result); 1354 SkASSERT(result);
1355 1355
1356 SkPixelRef* pr = fPixelRef; 1356 SkPixelRef* pr = fPixelRef;
1357 if (NULL == pr) { 1357 if (NULL == pr) {
1358 return false; 1358 return false;
1359 } 1359 }
1360 1360
1361 SkPixelRef::LockRequest req = { fInfo.dimensions(), kNone_SkFilterQuality }; 1361 SkPixelRef::LockRequest req = { fInfo.dimensions(), kNone_SkFilterQuality };
1362 SkPixelRef::LockResult res; 1362 SkPixelRef::LockResult res;
1363 if (pr->requestLock(req, &res)) { 1363 if (pr->requestLock(req, &res)) {
1364 SkASSERT(res.fPixels);
1364 // The bitmap may be a subset of the pixelref's dimensions 1365 // The bitmap may be a subset of the pixelref's dimensions
1365 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width()); 1366 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width());
1366 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height()); 1367 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height());
1367 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f Info.colorType(), 1368 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f Info.colorType(),
1368 f PixelRefOrigin.x(), 1369 f PixelRefOrigin.x(),
1369 f PixelRefOrigin.y(), 1370 f PixelRefOrigin.y(),
1370 r es.fRowBytes); 1371 r es.fRowBytes);
1371 1372
1372 result->reset(SkPixmap(this->info(), addr, res.fRowBytes, res.fCTable), 1373 result->reset(SkPixmap(this->info(), addr, res.fRowBytes, res.fCTable),
1373 res.fUnlockProc, res.fUnlockContext); 1374 res.fUnlockProc, res.fUnlockContext);
1374 return true; 1375 return true;
1375 } 1376 }
1376 return false; 1377 return false;
1377 } 1378 }
1378 1379
1379 /////////////////////////////////////////////////////////////////////////////// 1380 ///////////////////////////////////////////////////////////////////////////////
1380 1381
1381 #ifdef SK_DEBUG 1382 #ifdef SK_DEBUG
1382 void SkImageInfo::validate() const { 1383 void SkImageInfo::validate() const {
1383 SkASSERT(fWidth >= 0); 1384 SkASSERT(fWidth >= 0);
1384 SkASSERT(fHeight >= 0); 1385 SkASSERT(fHeight >= 0);
1385 SkASSERT(SkColorTypeIsValid(fColorType)); 1386 SkASSERT(SkColorTypeIsValid(fColorType));
1386 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1387 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1387 } 1388 }
1388 #endif 1389 #endif
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