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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 SkASSERT(srcRow == dstRow); // first row does not need to be moved | 1225 SkASSERT(srcRow == dstRow); // first row does not need to be moved |
1226 } | 1226 } |
1227 | 1227 |
1228 SkAutoTUnref<SkColorTable> ctable; | 1228 SkAutoTUnref<SkColorTable> ctable; |
1229 if (buffer->readBool()) { | 1229 if (buffer->readBool()) { |
1230 ctable.reset(SkNEW_ARGS(SkColorTable, (*buffer))); | 1230 ctable.reset(SkNEW_ARGS(SkColorTable, (*buffer))); |
1231 } | 1231 } |
1232 | 1232 |
1233 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowB
ytes(), | 1233 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowB
ytes(), |
1234 ctable.get(), data
.get())); | 1234 ctable.get(), data
.get())); |
| 1235 if (!pr.get()) { |
| 1236 return false; |
| 1237 } |
1235 bitmap->setInfo(pr->info()); | 1238 bitmap->setInfo(pr->info()); |
1236 bitmap->setPixelRef(pr, 0, 0); | 1239 bitmap->setPixelRef(pr, 0, 0); |
1237 return true; | 1240 return true; |
1238 } | 1241 } |
1239 | 1242 |
1240 enum { | 1243 enum { |
1241 SERIALIZE_PIXELTYPE_NONE, | 1244 SERIALIZE_PIXELTYPE_NONE, |
1242 SERIALIZE_PIXELTYPE_REF_DATA | 1245 SERIALIZE_PIXELTYPE_REF_DATA |
1243 }; | 1246 }; |
1244 | 1247 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 /////////////////////////////////////////////////////////////////////////////// | 1382 /////////////////////////////////////////////////////////////////////////////// |
1380 | 1383 |
1381 #ifdef SK_DEBUG | 1384 #ifdef SK_DEBUG |
1382 void SkImageInfo::validate() const { | 1385 void SkImageInfo::validate() const { |
1383 SkASSERT(fWidth >= 0); | 1386 SkASSERT(fWidth >= 0); |
1384 SkASSERT(fHeight >= 0); | 1387 SkASSERT(fHeight >= 0); |
1385 SkASSERT(SkColorTypeIsValid(fColorType)); | 1388 SkASSERT(SkColorTypeIsValid(fColorType)); |
1386 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1389 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1387 } | 1390 } |
1388 #endif | 1391 #endif |
OLD | NEW |