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

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

Issue 1199473002: change old picture serialization to really handle images (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
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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698