| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 break; | 195 break; |
| 196 default: | 196 default: |
| 197 return false; | 197 return false; |
| 198 } | 198 } |
| 199 if (canonical) { | 199 if (canonical) { |
| 200 *canonical = alphaType; | 200 *canonical = alphaType; |
| 201 } | 201 } |
| 202 return true; | 202 return true; |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool SkBitmap::setConfig(const SkImageInfo& origInfo, size_t rowBytes) { | 205 bool SkBitmap::setInfo(const SkImageInfo& origInfo, size_t rowBytes) { |
| 206 SkImageInfo info = origInfo; | 206 SkImageInfo info = origInfo; |
| 207 | 207 |
| 208 if (!validate_alphaType(info.fColorType, info.fAlphaType, | 208 if (!validate_alphaType(info.fColorType, info.fAlphaType, |
| 209 &info.fAlphaType)) { | 209 &info.fAlphaType)) { |
| 210 return reset_return_false(this); | 210 return reset_return_false(this); |
| 211 } | 211 } |
| 212 | 212 |
| 213 // require that rowBytes fit in 31bits | 213 // require that rowBytes fit in 31bits |
| 214 int64_t mrb = info.minRowBytes64(); | 214 int64_t mrb = info.minRowBytes64(); |
| 215 if ((int32_t)mrb != mrb) { | 215 if ((int32_t)mrb != mrb) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 234 this->freePixels(); | 234 this->freePixels(); |
| 235 | 235 |
| 236 fInfo = info; | 236 fInfo = info; |
| 237 fRowBytes = SkToU32(rowBytes); | 237 fRowBytes = SkToU32(rowBytes); |
| 238 return true; | 238 return true; |
| 239 } | 239 } |
| 240 | 240 |
| 241 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, | 241 bool SkBitmap::setConfig(Config config, int width, int height, size_t rowBytes, |
| 242 SkAlphaType alphaType) { | 242 SkAlphaType alphaType) { |
| 243 SkColorType ct = SkBitmapConfigToColorType(config); | 243 SkColorType ct = SkBitmapConfigToColorType(config); |
| 244 return this->setConfig(SkImageInfo::Make(width, height, ct, alphaType), | 244 return this->setInfo(SkImageInfo::Make(width, height, ct, alphaType), rowByt
es); |
| 245 rowBytes); | |
| 246 } | 245 } |
| 247 | 246 |
| 248 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { | 247 bool SkBitmap::setAlphaType(SkAlphaType alphaType) { |
| 249 if (!validate_alphaType(fInfo.fColorType, alphaType, &alphaType)) { | 248 if (!validate_alphaType(fInfo.fColorType, alphaType, &alphaType)) { |
| 250 return false; | 249 return false; |
| 251 } | 250 } |
| 252 if (fInfo.fAlphaType != alphaType) { | 251 if (fInfo.fAlphaType != alphaType) { |
| 253 fInfo.fAlphaType = alphaType; | 252 fInfo.fAlphaType = alphaType; |
| 254 if (fPixelRef) { | 253 if (fPixelRef) { |
| 255 fPixelRef->changeAlphaType(alphaType); | 254 fPixelRef->changeAlphaType(alphaType); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return allocator->allocPixelRef(this, ctable); | 411 return allocator->allocPixelRef(this, ctable); |
| 413 } | 412 } |
| 414 | 413 |
| 415 /////////////////////////////////////////////////////////////////////////////// | 414 /////////////////////////////////////////////////////////////////////////////// |
| 416 | 415 |
| 417 bool SkBitmap::allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, | 416 bool SkBitmap::allocPixels(const SkImageInfo& info, SkPixelRefFactory* factory, |
| 418 SkColorTable* ctable) { | 417 SkColorTable* ctable) { |
| 419 if (kIndex_8_SkColorType == info.fColorType && NULL == ctable) { | 418 if (kIndex_8_SkColorType == info.fColorType && NULL == ctable) { |
| 420 return reset_return_false(this); | 419 return reset_return_false(this); |
| 421 } | 420 } |
| 422 if (!this->setConfig(info)) { | 421 if (!this->setInfo(info)) { |
| 423 return reset_return_false(this); | 422 return reset_return_false(this); |
| 424 } | 423 } |
| 425 | 424 |
| 426 SkMallocPixelRef::PRFactory defaultFactory; | 425 SkMallocPixelRef::PRFactory defaultFactory; |
| 427 if (NULL == factory) { | 426 if (NULL == factory) { |
| 428 factory = &defaultFactory; | 427 factory = &defaultFactory; |
| 429 } | 428 } |
| 430 | 429 |
| 431 SkPixelRef* pr = factory->create(info, ctable); | 430 SkPixelRef* pr = factory->create(info, ctable); |
| 432 if (NULL == pr) { | 431 if (NULL == pr) { |
| 433 return reset_return_false(this); | 432 return reset_return_false(this); |
| 434 } | 433 } |
| 435 this->setPixelRef(pr)->unref(); | 434 this->setPixelRef(pr)->unref(); |
| 436 | 435 |
| 437 // TODO: lockPixels could/should return bool or void*/NULL | 436 // TODO: lockPixels could/should return bool or void*/NULL |
| 438 this->lockPixels(); | 437 this->lockPixels(); |
| 439 if (NULL == this->getPixels()) { | 438 if (NULL == this->getPixels()) { |
| 440 return reset_return_false(this); | 439 return reset_return_false(this); |
| 441 } | 440 } |
| 442 return true; | 441 return true; |
| 443 } | 442 } |
| 444 | 443 |
| 445 bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, S
kColorTable* ct, | 444 bool SkBitmap::installPixels(const SkImageInfo& info, void* pixels, size_t rb, S
kColorTable* ct, |
| 446 void (*releaseProc)(void* addr, void* context), voi
d* context) { | 445 void (*releaseProc)(void* addr, void* context), voi
d* context) { |
| 447 if (!this->setConfig(info, rb)) { | 446 if (!this->setInfo(info, rb)) { |
| 448 this->reset(); | 447 this->reset(); |
| 449 return false; | 448 return false; |
| 450 } | 449 } |
| 451 | 450 |
| 452 SkPixelRef* pr = SkMallocPixelRef::NewWithProc(info, rb, ct, pixels, release
Proc, context); | 451 SkPixelRef* pr = SkMallocPixelRef::NewWithProc(info, rb, ct, pixels, release
Proc, context); |
| 453 if (!pr) { | 452 if (!pr) { |
| 454 this->reset(); | 453 this->reset(); |
| 455 return false; | 454 return false; |
| 456 } | 455 } |
| 457 | 456 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 srcRect.set(0, 0, this->width(), this->height()); | 876 srcRect.set(0, 0, this->width(), this->height()); |
| 878 if (!r.intersect(srcRect, subset)) { | 877 if (!r.intersect(srcRect, subset)) { |
| 879 return false; // r is empty (i.e. no intersection) | 878 return false; // r is empty (i.e. no intersection) |
| 880 } | 879 } |
| 881 | 880 |
| 882 if (fPixelRef->getTexture() != NULL) { | 881 if (fPixelRef->getTexture() != NULL) { |
| 883 // Do a deep copy | 882 // Do a deep copy |
| 884 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); | 883 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); |
| 885 if (pixelRef != NULL) { | 884 if (pixelRef != NULL) { |
| 886 SkBitmap dst; | 885 SkBitmap dst; |
| 887 dst.setConfig(SkImageInfo::Make(subset.width(), subset.height(), | 886 dst.setInfo(SkImageInfo::Make(subset.width(), subset.height(), |
| 888 this->colorType(), this->alphaType()
)); | 887 this->colorType(), this->alphaType()))
; |
| 889 dst.setIsVolatile(this->isVolatile()); | 888 dst.setIsVolatile(this->isVolatile()); |
| 890 dst.setPixelRef(pixelRef)->unref(); | 889 dst.setPixelRef(pixelRef)->unref(); |
| 891 SkDEBUGCODE(dst.validate()); | 890 SkDEBUGCODE(dst.validate()); |
| 892 result->swap(dst); | 891 result->swap(dst); |
| 893 return true; | 892 return true; |
| 894 } | 893 } |
| 895 } | 894 } |
| 896 | 895 |
| 897 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have | 896 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have |
| 898 // exited above. | 897 // exited above. |
| 899 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); | 898 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); |
| 900 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height(
))); | 899 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height(
))); |
| 901 | 900 |
| 902 SkBitmap dst; | 901 SkBitmap dst; |
| 903 dst.setConfig(SkImageInfo::Make(r.width(), r.height(), this->colorType(), th
is->alphaType()), | 902 dst.setInfo(SkImageInfo::Make(r.width(), r.height(), this->colorType(), this
->alphaType()), |
| 904 this->rowBytes()); | 903 this->rowBytes()); |
| 905 dst.setIsVolatile(this->isVolatile()); | 904 dst.setIsVolatile(this->isVolatile()); |
| 906 | 905 |
| 907 if (fPixelRef) { | 906 if (fPixelRef) { |
| 908 SkIPoint origin = fPixelRefOrigin; | 907 SkIPoint origin = fPixelRefOrigin; |
| 909 origin.fX += r.fLeft; | 908 origin.fX += r.fLeft; |
| 910 origin.fY += r.fTop; | 909 origin.fY += r.fTop; |
| 911 // share the pixelref with a custom offset | 910 // share the pixelref with a custom offset |
| 912 dst.setPixelRef(fPixelRef, origin); | 911 dst.setPixelRef(fPixelRef, origin); |
| 913 } | 912 } |
| 914 SkDEBUGCODE(dst.validate();) | 913 SkDEBUGCODE(dst.validate();) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 return false; | 986 return false; |
| 988 } | 987 } |
| 989 | 988 |
| 990 // The only way to be readyToDraw is if fPixelRef is non NULL. | 989 // The only way to be readyToDraw is if fPixelRef is non NULL. |
| 991 SkASSERT(fPixelRef != NULL); | 990 SkASSERT(fPixelRef != NULL); |
| 992 | 991 |
| 993 SkImageInfo dstInfo = src->info(); | 992 SkImageInfo dstInfo = src->info(); |
| 994 dstInfo.fColorType = dstColorType; | 993 dstInfo.fColorType = dstColorType; |
| 995 | 994 |
| 996 SkBitmap tmpDst; | 995 SkBitmap tmpDst; |
| 997 if (!tmpDst.setConfig(dstInfo)) { | 996 if (!tmpDst.setInfo(dstInfo)) { |
| 998 return false; | 997 return false; |
| 999 } | 998 } |
| 1000 | 999 |
| 1001 // allocate colortable if srcConfig == kIndex8_Config | 1000 // allocate colortable if srcConfig == kIndex8_Config |
| 1002 SkAutoTUnref<SkColorTable> ctable; | 1001 SkAutoTUnref<SkColorTable> ctable; |
| 1003 if (dstColorType == kIndex_8_SkColorType) { | 1002 if (dstColorType == kIndex_8_SkColorType) { |
| 1004 // TODO: can we just ref() the src colortable? Is it reentrant-safe? | 1003 // TODO: can we just ref() the src colortable? Is it reentrant-safe? |
| 1005 ctable.reset(SkNEW_ARGS(SkColorTable, (*src->getColorTable()))); | 1004 ctable.reset(SkNEW_ARGS(SkColorTable, (*src->getColorTable()))); |
| 1006 } | 1005 } |
| 1007 if (!tmpDst.allocPixels(alloc, ctable)) { | 1006 if (!tmpDst.allocPixels(alloc, ctable)) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 if (pixelRef) { | 1094 if (pixelRef) { |
| 1096 uint32_t rowBytes; | 1095 uint32_t rowBytes; |
| 1097 if (this->colorType() == dstCT) { | 1096 if (this->colorType() == dstCT) { |
| 1098 // Since there is no subset to pass to deepCopy, and deepCopy | 1097 // Since there is no subset to pass to deepCopy, and deepCopy |
| 1099 // succeeded, the new pixel ref must be identical. | 1098 // succeeded, the new pixel ref must be identical. |
| 1100 SkASSERT(fPixelRef->info() == pixelRef->info()); | 1099 SkASSERT(fPixelRef->info() == pixelRef->info()); |
| 1101 pixelRef->cloneGenID(*fPixelRef); | 1100 pixelRef->cloneGenID(*fPixelRef); |
| 1102 // Use the same rowBytes as the original. | 1101 // Use the same rowBytes as the original. |
| 1103 rowBytes = fRowBytes; | 1102 rowBytes = fRowBytes; |
| 1104 } else { | 1103 } else { |
| 1105 // With the new config, an appropriate fRowBytes will be compute
d by setConfig. | 1104 // With the new config, an appropriate fRowBytes will be compute
d by setInfo. |
| 1106 rowBytes = 0; | 1105 rowBytes = 0; |
| 1107 } | 1106 } |
| 1108 | 1107 |
| 1109 SkImageInfo info = fInfo; | 1108 SkImageInfo info = fInfo; |
| 1110 info.fColorType = dstCT; | 1109 info.fColorType = dstCT; |
| 1111 if (!dst->setConfig(info, rowBytes)) { | 1110 if (!dst->setInfo(info, rowBytes)) { |
| 1112 return false; | 1111 return false; |
| 1113 } | 1112 } |
| 1114 dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref(); | 1113 dst->setPixelRef(pixelRef, fPixelRefOrigin)->unref(); |
| 1115 return true; | 1114 return true; |
| 1116 } | 1115 } |
| 1117 } | 1116 } |
| 1118 | 1117 |
| 1119 if (this->getTexture()) { | 1118 if (this->getTexture()) { |
| 1120 return false; | 1119 return false; |
| 1121 } else { | 1120 } else { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 // compute our (larger?) dst bounds if we have a filter | 1210 // compute our (larger?) dst bounds if we have a filter |
| 1212 if (NULL != filter) { | 1211 if (NULL != filter) { |
| 1213 identity.reset(); | 1212 identity.reset(); |
| 1214 srcM.fImage = NULL; | 1213 srcM.fImage = NULL; |
| 1215 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { | 1214 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { |
| 1216 goto NO_FILTER_CASE; | 1215 goto NO_FILTER_CASE; |
| 1217 } | 1216 } |
| 1218 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); | 1217 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); |
| 1219 } else { | 1218 } else { |
| 1220 NO_FILTER_CASE: | 1219 NO_FILTER_CASE: |
| 1221 tmpBitmap.setConfig(SkImageInfo::MakeA8(this->width(), this->height()),
srcM.fRowBytes); | 1220 tmpBitmap.setInfo(SkImageInfo::MakeA8(this->width(), this->height()), sr
cM.fRowBytes); |
| 1222 if (!tmpBitmap.allocPixels(allocator, NULL)) { | 1221 if (!tmpBitmap.allocPixels(allocator, NULL)) { |
| 1223 // Allocation of pixels for alpha bitmap failed. | 1222 // Allocation of pixels for alpha bitmap failed. |
| 1224 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", | 1223 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", |
| 1225 tmpBitmap.width(), tmpBitmap.height()); | 1224 tmpBitmap.width(), tmpBitmap.height()); |
| 1226 return false; | 1225 return false; |
| 1227 } | 1226 } |
| 1228 GetBitmapAlpha(*this, tmpBitmap.getAddr8(0, 0), srcM.fRowBytes); | 1227 GetBitmapAlpha(*this, tmpBitmap.getAddr8(0, 0), srcM.fRowBytes); |
| 1229 if (offset) { | 1228 if (offset) { |
| 1230 offset->set(0, 0); | 1229 offset->set(0, 0); |
| 1231 } | 1230 } |
| 1232 tmpBitmap.swap(*dst); | 1231 tmpBitmap.swap(*dst); |
| 1233 return true; | 1232 return true; |
| 1234 } | 1233 } |
| 1235 srcM.fImage = SkMask::AllocImage(srcM.computeImageSize()); | 1234 srcM.fImage = SkMask::AllocImage(srcM.computeImageSize()); |
| 1236 SkAutoMaskFreeImage srcCleanup(srcM.fImage); | 1235 SkAutoMaskFreeImage srcCleanup(srcM.fImage); |
| 1237 | 1236 |
| 1238 GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes); | 1237 GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes); |
| 1239 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { | 1238 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { |
| 1240 goto NO_FILTER_CASE; | 1239 goto NO_FILTER_CASE; |
| 1241 } | 1240 } |
| 1242 SkAutoMaskFreeImage dstCleanup(dstM.fImage); | 1241 SkAutoMaskFreeImage dstCleanup(dstM.fImage); |
| 1243 | 1242 |
| 1244 tmpBitmap.setConfig(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.h
eight()), | 1243 tmpBitmap.setInfo(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.hei
ght()), |
| 1245 dstM.fRowBytes); | 1244 dstM.fRowBytes); |
| 1246 if (!tmpBitmap.allocPixels(allocator, NULL)) { | 1245 if (!tmpBitmap.allocPixels(allocator, NULL)) { |
| 1247 // Allocation of pixels for alpha bitmap failed. | 1246 // Allocation of pixels for alpha bitmap failed. |
| 1248 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", | 1247 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", |
| 1249 tmpBitmap.width(), tmpBitmap.height()); | 1248 tmpBitmap.width(), tmpBitmap.height()); |
| 1250 return false; | 1249 return false; |
| 1251 } | 1250 } |
| 1252 memcpy(tmpBitmap.getPixels(), dstM.fImage, dstM.computeImageSize()); | 1251 memcpy(tmpBitmap.getPixels(), dstM.fImage, dstM.computeImageSize()); |
| 1253 if (offset) { | 1252 if (offset) { |
| 1254 offset->set(dstM.fBounds.fLeft, dstM.fBounds.fTop); | 1253 offset->set(dstM.fBounds.fLeft, dstM.fBounds.fTop); |
| 1255 } | 1254 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 SkASSERT(srcRow == dstRow); // first row does not need to be moved | 1324 SkASSERT(srcRow == dstRow); // first row does not need to be moved |
| 1326 } | 1325 } |
| 1327 | 1326 |
| 1328 SkAutoTUnref<SkColorTable> ctable; | 1327 SkAutoTUnref<SkColorTable> ctable; |
| 1329 if (buffer->readBool()) { | 1328 if (buffer->readBool()) { |
| 1330 ctable.reset(SkNEW_ARGS(SkColorTable, (*buffer))); | 1329 ctable.reset(SkNEW_ARGS(SkColorTable, (*buffer))); |
| 1331 } | 1330 } |
| 1332 | 1331 |
| 1333 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowB
ytes(), | 1332 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewWithData(info, info.minRowB
ytes(), |
| 1334 ctable.get(), data
.get())); | 1333 ctable.get(), data
.get())); |
| 1335 bitmap->setConfig(pr->info()); | 1334 bitmap->setInfo(pr->info()); |
| 1336 bitmap->setPixelRef(pr, 0, 0); | 1335 bitmap->setPixelRef(pr, 0, 0); |
| 1337 return true; | 1336 return true; |
| 1338 } | 1337 } |
| 1339 | 1338 |
| 1340 enum { | 1339 enum { |
| 1341 SERIALIZE_PIXELTYPE_NONE, | 1340 SERIALIZE_PIXELTYPE_NONE, |
| 1342 SERIALIZE_PIXELTYPE_REF_DATA | 1341 SERIALIZE_PIXELTYPE_REF_DATA |
| 1343 }; | 1342 }; |
| 1344 | 1343 |
| 1345 void SkBitmap::legacyUnflatten(SkReadBuffer& buffer) { | 1344 void SkBitmap::legacyUnflatten(SkReadBuffer& buffer) { |
| 1346 this->reset(); | 1345 this->reset(); |
| 1347 | 1346 |
| 1348 SkImageInfo info; | 1347 SkImageInfo info; |
| 1349 info.unflatten(buffer); | 1348 info.unflatten(buffer); |
| 1350 size_t rowBytes = buffer.readInt(); | 1349 size_t rowBytes = buffer.readInt(); |
| 1351 if (!buffer.validate((info.width() >= 0) && (info.height() >= 0) && | 1350 if (!buffer.validate((info.width() >= 0) && (info.height() >= 0) && |
| 1352 SkColorTypeIsValid(info.fColorType) && | 1351 SkColorTypeIsValid(info.fColorType) && |
| 1353 SkAlphaTypeIsValid(info.fAlphaType) && | 1352 SkAlphaTypeIsValid(info.fAlphaType) && |
| 1354 validate_alphaType(info.fColorType, info.fAlphaType) && | 1353 validate_alphaType(info.fColorType, info.fAlphaType) && |
| 1355 info.validRowBytes(rowBytes))) { | 1354 info.validRowBytes(rowBytes))) { |
| 1356 return; | 1355 return; |
| 1357 } | 1356 } |
| 1358 | 1357 |
| 1359 bool configIsValid = this->setConfig(info, rowBytes); | 1358 bool configIsValid = this->setInfo(info, rowBytes); |
| 1360 buffer.validate(configIsValid); | 1359 buffer.validate(configIsValid); |
| 1361 | 1360 |
| 1362 int reftype = buffer.readInt(); | 1361 int reftype = buffer.readInt(); |
| 1363 if (buffer.validate((SERIALIZE_PIXELTYPE_REF_DATA == reftype) || | 1362 if (buffer.validate((SERIALIZE_PIXELTYPE_REF_DATA == reftype) || |
| 1364 (SERIALIZE_PIXELTYPE_NONE == reftype))) { | 1363 (SERIALIZE_PIXELTYPE_NONE == reftype))) { |
| 1365 switch (reftype) { | 1364 switch (reftype) { |
| 1366 case SERIALIZE_PIXELTYPE_REF_DATA: { | 1365 case SERIALIZE_PIXELTYPE_REF_DATA: { |
| 1367 SkIPoint origin; | 1366 SkIPoint origin; |
| 1368 origin.fX = buffer.readInt(); | 1367 origin.fX = buffer.readInt(); |
| 1369 origin.fY = buffer.readInt(); | 1368 origin.fY = buffer.readInt(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 /////////////////////////////////////////////////////////////////////////////// | 1474 /////////////////////////////////////////////////////////////////////////////// |
| 1476 | 1475 |
| 1477 #ifdef SK_DEBUG | 1476 #ifdef SK_DEBUG |
| 1478 void SkImageInfo::validate() const { | 1477 void SkImageInfo::validate() const { |
| 1479 SkASSERT(fWidth >= 0); | 1478 SkASSERT(fWidth >= 0); |
| 1480 SkASSERT(fHeight >= 0); | 1479 SkASSERT(fHeight >= 0); |
| 1481 SkASSERT(SkColorTypeIsValid(fColorType)); | 1480 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1482 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1481 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1483 } | 1482 } |
| 1484 #endif | 1483 #endif |
| OLD | NEW |