Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1263 /////////////////////////////////////////////////////////////////////////////// | 1263 /////////////////////////////////////////////////////////////////////////////// |
| 1264 | 1264 |
| 1265 bool SkBitmap::requestLock(SkAutoPixmapUnlock* result) const { | 1265 bool SkBitmap::requestLock(SkAutoPixmapUnlock* result) const { |
| 1266 SkASSERT(result); | 1266 SkASSERT(result); |
| 1267 | 1267 |
| 1268 SkPixelRef* pr = fPixelRef; | 1268 SkPixelRef* pr = fPixelRef; |
| 1269 if (NULL == pr) { | 1269 if (NULL == pr) { |
| 1270 return false; | 1270 return false; |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 SkPixelRef::LockRequest req = { fInfo.dimensions(), kNone_SkFilterQuality }; | 1273 SkPixelRef::LockRequest req = { pr->info().dimensions(), kNone_SkFilterQuali ty }; |
|
scroggo
2015/06/22 17:40:01
Why this change?
reed1
2015/06/22 18:41:50
I'll add a comment -- the pixelref cannot do subse
| |
| 1274 SkPixelRef::LockResult res; | 1274 SkPixelRef::LockResult res; |
| 1275 if (pr->requestLock(req, &res)) { | 1275 if (pr->requestLock(req, &res)) { |
| 1276 SkASSERT(res.fPixels); | 1276 SkASSERT(res.fPixels); |
| 1277 // The bitmap may be a subset of the pixelref's dimensions | 1277 // The bitmap may be a subset of the pixelref's dimensions |
| 1278 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width()); | 1278 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width()); |
| 1279 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height()); | 1279 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height()); |
| 1280 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f Info.colorType(), | 1280 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f Info.colorType(), |
| 1281 f PixelRefOrigin.x(), | 1281 f PixelRefOrigin.x(), |
| 1282 f PixelRefOrigin.y(), | 1282 f PixelRefOrigin.y(), |
| 1283 r es.fRowBytes); | 1283 r es.fRowBytes); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1302 /////////////////////////////////////////////////////////////////////////////// | 1302 /////////////////////////////////////////////////////////////////////////////// |
| 1303 | 1303 |
| 1304 #ifdef SK_DEBUG | 1304 #ifdef SK_DEBUG |
| 1305 void SkImageInfo::validate() const { | 1305 void SkImageInfo::validate() const { |
| 1306 SkASSERT(fWidth >= 0); | 1306 SkASSERT(fWidth >= 0); |
| 1307 SkASSERT(fHeight >= 0); | 1307 SkASSERT(fHeight >= 0); |
| 1308 SkASSERT(SkColorTypeIsValid(fColorType)); | 1308 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1310 } | 1310 } |
| 1311 #endif | 1311 #endif |
| OLD | NEW |