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 // We have to lock the whole thing (using the pixelref's dimensions) until t
he api supports |
| 1274 // a partial lock (with offset/origin). Hence we can't use our fInfo. |
| 1275 SkPixelRef::LockRequest req = { pr->info().dimensions(), kNone_SkFilterQuali
ty }; |
1274 SkPixelRef::LockResult res; | 1276 SkPixelRef::LockResult res; |
1275 if (pr->requestLock(req, &res)) { | 1277 if (pr->requestLock(req, &res)) { |
1276 SkASSERT(res.fPixels); | 1278 SkASSERT(res.fPixels); |
1277 // The bitmap may be a subset of the pixelref's dimensions | 1279 // The bitmap may be a subset of the pixelref's dimensions |
1278 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width()); | 1280 SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width()); |
1279 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height()); | 1281 SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height()); |
1280 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f
Info.colorType(), | 1282 const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(f
Info.colorType(), |
1281 f
PixelRefOrigin.x(), | 1283 f
PixelRefOrigin.x(), |
1282 f
PixelRefOrigin.y(), | 1284 f
PixelRefOrigin.y(), |
1283 r
es.fRowBytes); | 1285 r
es.fRowBytes); |
(...skipping 18 matching lines...) Expand all Loading... |
1302 /////////////////////////////////////////////////////////////////////////////// | 1304 /////////////////////////////////////////////////////////////////////////////// |
1303 | 1305 |
1304 #ifdef SK_DEBUG | 1306 #ifdef SK_DEBUG |
1305 void SkImageInfo::validate() const { | 1307 void SkImageInfo::validate() const { |
1306 SkASSERT(fWidth >= 0); | 1308 SkASSERT(fWidth >= 0); |
1307 SkASSERT(fHeight >= 0); | 1309 SkASSERT(fHeight >= 0); |
1308 SkASSERT(SkColorTypeIsValid(fColorType)); | 1310 SkASSERT(SkColorTypeIsValid(fColorType)); |
1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1311 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1310 } | 1312 } |
1311 #endif | 1313 #endif |
OLD | NEW |