| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 break; | 641 break; |
| 642 } | 642 } |
| 643 } | 643 } |
| 644 return base; | 644 return base; |
| 645 } | 645 } |
| 646 | 646 |
| 647 SkColor SkBitmap::getColor(int x, int y) const { | 647 SkColor SkBitmap::getColor(int x, int y) const { |
| 648 SkASSERT((unsigned)x < (unsigned)this->width()); | 648 SkASSERT((unsigned)x < (unsigned)this->width()); |
| 649 SkASSERT((unsigned)y < (unsigned)this->height()); | 649 SkASSERT((unsigned)y < (unsigned)this->height()); |
| 650 | 650 |
| 651 switch (this->config()) { | 651 switch (this->colorType()) { |
| 652 case SkBitmap::kA8_Config: { | 652 case kAlpha_8_SkColorType: { |
| 653 uint8_t* addr = this->getAddr8(x, y); | 653 uint8_t* addr = this->getAddr8(x, y); |
| 654 return SkColorSetA(0, addr[0]); | 654 return SkColorSetA(0, addr[0]); |
| 655 } | 655 } |
| 656 case SkBitmap::kIndex8_Config: { | 656 case kIndex_8_SkColorType: { |
| 657 SkPMColor c = this->getIndex8Color(x, y); | 657 SkPMColor c = this->getIndex8Color(x, y); |
| 658 return SkUnPreMultiply::PMColorToColor(c); | 658 return SkUnPreMultiply::PMColorToColor(c); |
| 659 } | 659 } |
| 660 case SkBitmap::kRGB_565_Config: { | 660 case kRGB_565_SkColorType: { |
| 661 uint16_t* addr = this->getAddr16(x, y); | 661 uint16_t* addr = this->getAddr16(x, y); |
| 662 return SkPixel16ToColor(addr[0]); | 662 return SkPixel16ToColor(addr[0]); |
| 663 } | 663 } |
| 664 case SkBitmap::kARGB_4444_Config: { | 664 case kARGB_4444_SkColorType: { |
| 665 uint16_t* addr = this->getAddr16(x, y); | 665 uint16_t* addr = this->getAddr16(x, y); |
| 666 SkPMColor c = SkPixel4444ToPixel32(addr[0]); | 666 SkPMColor c = SkPixel4444ToPixel32(addr[0]); |
| 667 return SkUnPreMultiply::PMColorToColor(c); | 667 return SkUnPreMultiply::PMColorToColor(c); |
| 668 } | 668 } |
| 669 case SkBitmap::kARGB_8888_Config: { | 669 case kBGRA_8888_SkColorType: |
| 670 case kRGBA_8888_SkColorType: { |
| 670 uint32_t* addr = this->getAddr32(x, y); | 671 uint32_t* addr = this->getAddr32(x, y); |
| 671 return SkUnPreMultiply::PMColorToColor(addr[0]); | 672 return SkUnPreMultiply::PMColorToColor(addr[0]); |
| 672 } | 673 } |
| 673 case kNo_Config: | |
| 674 default: | 674 default: |
| 675 SkASSERT(false); | 675 SkASSERT(false); |
| 676 return 0; | 676 return 0; |
| 677 } | 677 } |
| 678 SkASSERT(false); // Not reached. | 678 SkASSERT(false); // Not reached. |
| 679 return 0; | 679 return 0; |
| 680 } | 680 } |
| 681 | 681 |
| 682 bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) { | 682 bool SkBitmap::ComputeIsOpaque(const SkBitmap& bm) { |
| 683 SkAutoLockPixels alp(bm); | 683 SkAutoLockPixels alp(bm); |
| 684 if (!bm.getPixels()) { | 684 if (!bm.getPixels()) { |
| 685 return false; | 685 return false; |
| 686 } | 686 } |
| 687 | 687 |
| 688 const int height = bm.height(); | 688 const int height = bm.height(); |
| 689 const int width = bm.width(); | 689 const int width = bm.width(); |
| 690 | 690 |
| 691 switch (bm.config()) { | 691 switch (bm.colorType()) { |
| 692 case SkBitmap::kA8_Config: { | 692 case kAlpha_8_SkColorType: { |
| 693 unsigned a = 0xFF; | 693 unsigned a = 0xFF; |
| 694 for (int y = 0; y < height; ++y) { | 694 for (int y = 0; y < height; ++y) { |
| 695 const uint8_t* row = bm.getAddr8(0, y); | 695 const uint8_t* row = bm.getAddr8(0, y); |
| 696 for (int x = 0; x < width; ++x) { | 696 for (int x = 0; x < width; ++x) { |
| 697 a &= row[x]; | 697 a &= row[x]; |
| 698 } | 698 } |
| 699 if (0xFF != a) { | 699 if (0xFF != a) { |
| 700 return false; | 700 return false; |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 return true; | 703 return true; |
| 704 } break; | 704 } break; |
| 705 case SkBitmap::kIndex8_Config: { | 705 case kIndex_8_SkColorType: { |
| 706 SkAutoLockColors alc(bm); | 706 SkAutoLockColors alc(bm); |
| 707 const SkPMColor* table = alc.colors(); | 707 const SkPMColor* table = alc.colors(); |
| 708 if (!table) { | 708 if (!table) { |
| 709 return false; | 709 return false; |
| 710 } | 710 } |
| 711 SkPMColor c = (SkPMColor)~0; | 711 SkPMColor c = (SkPMColor)~0; |
| 712 for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) { | 712 for (int i = bm.getColorTable()->count() - 1; i >= 0; --i) { |
| 713 c &= table[i]; | 713 c &= table[i]; |
| 714 } | 714 } |
| 715 return 0xFF == SkGetPackedA32(c); | 715 return 0xFF == SkGetPackedA32(c); |
| 716 } break; | 716 } break; |
| 717 case SkBitmap::kRGB_565_Config: | 717 case kRGB_565_SkColorType: |
| 718 return true; | 718 return true; |
| 719 break; | 719 break; |
| 720 case SkBitmap::kARGB_4444_Config: { | 720 case kARGB_4444_SkColorType: { |
| 721 unsigned c = 0xFFFF; | 721 unsigned c = 0xFFFF; |
| 722 for (int y = 0; y < height; ++y) { | 722 for (int y = 0; y < height; ++y) { |
| 723 const SkPMColor16* row = bm.getAddr16(0, y); | 723 const SkPMColor16* row = bm.getAddr16(0, y); |
| 724 for (int x = 0; x < width; ++x) { | 724 for (int x = 0; x < width; ++x) { |
| 725 c &= row[x]; | 725 c &= row[x]; |
| 726 } | 726 } |
| 727 if (0xF != SkGetPackedA4444(c)) { | 727 if (0xF != SkGetPackedA4444(c)) { |
| 728 return false; | 728 return false; |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 return true; | 731 return true; |
| 732 } break; | 732 } break; |
| 733 case SkBitmap::kARGB_8888_Config: { | 733 case kBGRA_8888_SkColorType: |
| 734 case kRGBA_8888_SkColorType: { |
| 734 SkPMColor c = (SkPMColor)~0; | 735 SkPMColor c = (SkPMColor)~0; |
| 735 for (int y = 0; y < height; ++y) { | 736 for (int y = 0; y < height; ++y) { |
| 736 const SkPMColor* row = bm.getAddr32(0, y); | 737 const SkPMColor* row = bm.getAddr32(0, y); |
| 737 for (int x = 0; x < width; ++x) { | 738 for (int x = 0; x < width; ++x) { |
| 738 c &= row[x]; | 739 c &= row[x]; |
| 739 } | 740 } |
| 740 if (0xFF != SkGetPackedA32(c)) { | 741 if (0xFF != SkGetPackedA32(c)) { |
| 741 return false; | 742 return false; |
| 742 } | 743 } |
| 743 } | 744 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 srcRect.set(0, 0, this->width(), this->height()); | 879 srcRect.set(0, 0, this->width(), this->height()); |
| 879 if (!r.intersect(srcRect, subset)) { | 880 if (!r.intersect(srcRect, subset)) { |
| 880 return false; // r is empty (i.e. no intersection) | 881 return false; // r is empty (i.e. no intersection) |
| 881 } | 882 } |
| 882 | 883 |
| 883 if (fPixelRef->getTexture() != NULL) { | 884 if (fPixelRef->getTexture() != NULL) { |
| 884 // Do a deep copy | 885 // Do a deep copy |
| 885 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); | 886 SkPixelRef* pixelRef = fPixelRef->deepCopy(this->config(), &subset); |
| 886 if (pixelRef != NULL) { | 887 if (pixelRef != NULL) { |
| 887 SkBitmap dst; | 888 SkBitmap dst; |
| 888 dst.setConfig(this->config(), subset.width(), subset.height(), 0, | 889 dst.setConfig(SkImageInfo::Make(subset.width(), subset.height(), |
| 889 this->alphaType()); | 890 this->colorType(), this->alphaType()
)); |
| 890 dst.setIsVolatile(this->isVolatile()); | 891 dst.setIsVolatile(this->isVolatile()); |
| 891 dst.setPixelRef(pixelRef)->unref(); | 892 dst.setPixelRef(pixelRef)->unref(); |
| 892 SkDEBUGCODE(dst.validate()); | 893 SkDEBUGCODE(dst.validate()); |
| 893 result->swap(dst); | 894 result->swap(dst); |
| 894 return true; | 895 return true; |
| 895 } | 896 } |
| 896 } | 897 } |
| 897 | 898 |
| 898 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have | 899 // If the upper left of the rectangle was outside the bounds of this SkBitma
p, we should have |
| 899 // exited above. | 900 // exited above. |
| 900 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); | 901 SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width(
))); |
| 901 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height(
))); | 902 SkASSERT(static_cast<unsigned>(r.fTop) < static_cast<unsigned>(this->height(
))); |
| 902 | 903 |
| 903 SkBitmap dst; | 904 SkBitmap dst; |
| 904 dst.setConfig(this->config(), r.width(), r.height(), this->rowBytes(), | 905 dst.setConfig(SkImageInfo::Make(r.width(), r.height(), this->colorType(), th
is->alphaType()), |
| 905 this->alphaType()); | 906 this->rowBytes()); |
| 906 dst.setIsVolatile(this->isVolatile()); | 907 dst.setIsVolatile(this->isVolatile()); |
| 907 | 908 |
| 908 if (fPixelRef) { | 909 if (fPixelRef) { |
| 909 SkIPoint origin = fPixelRefOrigin; | 910 SkIPoint origin = fPixelRefOrigin; |
| 910 origin.fX += r.fLeft; | 911 origin.fX += r.fLeft; |
| 911 origin.fY += r.fTop; | 912 origin.fY += r.fTop; |
| 912 // share the pixelref with a custom offset | 913 // share the pixelref with a custom offset |
| 913 dst.setPixelRef(fPixelRef, origin); | 914 dst.setPixelRef(fPixelRef, origin); |
| 914 } | 915 } |
| 915 SkDEBUGCODE(dst.validate();) | 916 SkDEBUGCODE(dst.validate();) |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 } | 1125 } |
| 1125 } | 1126 } |
| 1126 | 1127 |
| 1127 /////////////////////////////////////////////////////////////////////////////// | 1128 /////////////////////////////////////////////////////////////////////////////// |
| 1128 | 1129 |
| 1129 static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, | 1130 static bool GetBitmapAlpha(const SkBitmap& src, uint8_t* SK_RESTRICT alpha, |
| 1130 int alphaRowBytes) { | 1131 int alphaRowBytes) { |
| 1131 SkASSERT(alpha != NULL); | 1132 SkASSERT(alpha != NULL); |
| 1132 SkASSERT(alphaRowBytes >= src.width()); | 1133 SkASSERT(alphaRowBytes >= src.width()); |
| 1133 | 1134 |
| 1134 SkBitmap::Config config = src.config(); | 1135 SkColorType colorType = src.colorType(); |
| 1135 int w = src.width(); | 1136 int w = src.width(); |
| 1136 int h = src.height(); | 1137 int h = src.height(); |
| 1137 size_t rb = src.rowBytes(); | 1138 size_t rb = src.rowBytes(); |
| 1138 | 1139 |
| 1139 SkAutoLockPixels alp(src); | 1140 SkAutoLockPixels alp(src); |
| 1140 if (!src.readyToDraw()) { | 1141 if (!src.readyToDraw()) { |
| 1141 // zero out the alpha buffer and return | 1142 // zero out the alpha buffer and return |
| 1142 while (--h >= 0) { | 1143 while (--h >= 0) { |
| 1143 memset(alpha, 0, w); | 1144 memset(alpha, 0, w); |
| 1144 alpha += alphaRowBytes; | 1145 alpha += alphaRowBytes; |
| 1145 } | 1146 } |
| 1146 return false; | 1147 return false; |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 if (SkBitmap::kA8_Config == config && !src.isOpaque()) { | 1150 if (kAlpha_8_SkColorType == colorType && !src.isOpaque()) { |
| 1150 const uint8_t* s = src.getAddr8(0, 0); | 1151 const uint8_t* s = src.getAddr8(0, 0); |
| 1151 while (--h >= 0) { | 1152 while (--h >= 0) { |
| 1152 memcpy(alpha, s, w); | 1153 memcpy(alpha, s, w); |
| 1153 s += rb; | 1154 s += rb; |
| 1154 alpha += alphaRowBytes; | 1155 alpha += alphaRowBytes; |
| 1155 } | 1156 } |
| 1156 } else if (SkBitmap::kARGB_8888_Config == config && !src.isOpaque()) { | 1157 } else if (kN32_SkColorType == colorType && !src.isOpaque()) { |
| 1157 const SkPMColor* SK_RESTRICT s = src.getAddr32(0, 0); | 1158 const SkPMColor* SK_RESTRICT s = src.getAddr32(0, 0); |
| 1158 while (--h >= 0) { | 1159 while (--h >= 0) { |
| 1159 for (int x = 0; x < w; x++) { | 1160 for (int x = 0; x < w; x++) { |
| 1160 alpha[x] = SkGetPackedA32(s[x]); | 1161 alpha[x] = SkGetPackedA32(s[x]); |
| 1161 } | 1162 } |
| 1162 s = (const SkPMColor*)((const char*)s + rb); | 1163 s = (const SkPMColor*)((const char*)s + rb); |
| 1163 alpha += alphaRowBytes; | 1164 alpha += alphaRowBytes; |
| 1164 } | 1165 } |
| 1165 } else if (SkBitmap::kARGB_4444_Config == config && !src.isOpaque()) { | 1166 } else if (kARGB_4444_SkColorType == colorType && !src.isOpaque()) { |
| 1166 const SkPMColor16* SK_RESTRICT s = src.getAddr16(0, 0); | 1167 const SkPMColor16* SK_RESTRICT s = src.getAddr16(0, 0); |
| 1167 while (--h >= 0) { | 1168 while (--h >= 0) { |
| 1168 for (int x = 0; x < w; x++) { | 1169 for (int x = 0; x < w; x++) { |
| 1169 alpha[x] = SkPacked4444ToA32(s[x]); | 1170 alpha[x] = SkPacked4444ToA32(s[x]); |
| 1170 } | 1171 } |
| 1171 s = (const SkPMColor16*)((const char*)s + rb); | 1172 s = (const SkPMColor16*)((const char*)s + rb); |
| 1172 alpha += alphaRowBytes; | 1173 alpha += alphaRowBytes; |
| 1173 } | 1174 } |
| 1174 } else if (SkBitmap::kIndex8_Config == config && !src.isOpaque()) { | 1175 } else if (kIndex_8_SkColorType == colorType && !src.isOpaque()) { |
| 1175 SkColorTable* ct = src.getColorTable(); | 1176 SkColorTable* ct = src.getColorTable(); |
| 1176 if (ct) { | 1177 if (ct) { |
| 1177 const SkPMColor* SK_RESTRICT table = ct->lockColors(); | 1178 const SkPMColor* SK_RESTRICT table = ct->lockColors(); |
| 1178 const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0); | 1179 const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0); |
| 1179 while (--h >= 0) { | 1180 while (--h >= 0) { |
| 1180 for (int x = 0; x < w; x++) { | 1181 for (int x = 0; x < w; x++) { |
| 1181 alpha[x] = SkGetPackedA32(table[s[x]]); | 1182 alpha[x] = SkGetPackedA32(table[s[x]]); |
| 1182 } | 1183 } |
| 1183 s += rb; | 1184 s += rb; |
| 1184 alpha += alphaRowBytes; | 1185 alpha += alphaRowBytes; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1212 // compute our (larger?) dst bounds if we have a filter | 1213 // compute our (larger?) dst bounds if we have a filter |
| 1213 if (NULL != filter) { | 1214 if (NULL != filter) { |
| 1214 identity.reset(); | 1215 identity.reset(); |
| 1215 srcM.fImage = NULL; | 1216 srcM.fImage = NULL; |
| 1216 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { | 1217 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { |
| 1217 goto NO_FILTER_CASE; | 1218 goto NO_FILTER_CASE; |
| 1218 } | 1219 } |
| 1219 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); | 1220 dstM.fRowBytes = SkAlign4(dstM.fBounds.width()); |
| 1220 } else { | 1221 } else { |
| 1221 NO_FILTER_CASE: | 1222 NO_FILTER_CASE: |
| 1222 tmpBitmap.setConfig(SkBitmap::kA8_Config, this->width(), this->height(), | 1223 tmpBitmap.setConfig(SkImageInfo::MakeA8(this->width(), this->height()),
srcM.fRowBytes); |
| 1223 srcM.fRowBytes); | |
| 1224 if (!tmpBitmap.allocPixels(allocator, NULL)) { | 1224 if (!tmpBitmap.allocPixels(allocator, NULL)) { |
| 1225 // Allocation of pixels for alpha bitmap failed. | 1225 // Allocation of pixels for alpha bitmap failed. |
| 1226 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", | 1226 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", |
| 1227 tmpBitmap.width(), tmpBitmap.height()); | 1227 tmpBitmap.width(), tmpBitmap.height()); |
| 1228 return false; | 1228 return false; |
| 1229 } | 1229 } |
| 1230 GetBitmapAlpha(*this, tmpBitmap.getAddr8(0, 0), srcM.fRowBytes); | 1230 GetBitmapAlpha(*this, tmpBitmap.getAddr8(0, 0), srcM.fRowBytes); |
| 1231 if (offset) { | 1231 if (offset) { |
| 1232 offset->set(0, 0); | 1232 offset->set(0, 0); |
| 1233 } | 1233 } |
| 1234 tmpBitmap.swap(*dst); | 1234 tmpBitmap.swap(*dst); |
| 1235 return true; | 1235 return true; |
| 1236 } | 1236 } |
| 1237 srcM.fImage = SkMask::AllocImage(srcM.computeImageSize()); | 1237 srcM.fImage = SkMask::AllocImage(srcM.computeImageSize()); |
| 1238 SkAutoMaskFreeImage srcCleanup(srcM.fImage); | 1238 SkAutoMaskFreeImage srcCleanup(srcM.fImage); |
| 1239 | 1239 |
| 1240 GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes); | 1240 GetBitmapAlpha(*this, srcM.fImage, srcM.fRowBytes); |
| 1241 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { | 1241 if (!filter->filterMask(&dstM, srcM, identity, NULL)) { |
| 1242 goto NO_FILTER_CASE; | 1242 goto NO_FILTER_CASE; |
| 1243 } | 1243 } |
| 1244 SkAutoMaskFreeImage dstCleanup(dstM.fImage); | 1244 SkAutoMaskFreeImage dstCleanup(dstM.fImage); |
| 1245 | 1245 |
| 1246 tmpBitmap.setConfig(SkBitmap::kA8_Config, dstM.fBounds.width(), | 1246 tmpBitmap.setConfig(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.h
eight()), |
| 1247 dstM.fBounds.height(), dstM.fRowBytes); | 1247 dstM.fRowBytes); |
| 1248 if (!tmpBitmap.allocPixels(allocator, NULL)) { | 1248 if (!tmpBitmap.allocPixels(allocator, NULL)) { |
| 1249 // Allocation of pixels for alpha bitmap failed. | 1249 // Allocation of pixels for alpha bitmap failed. |
| 1250 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", | 1250 SkDebugf("extractAlpha failed to allocate (%d,%d) alpha bitmap\n", |
| 1251 tmpBitmap.width(), tmpBitmap.height()); | 1251 tmpBitmap.width(), tmpBitmap.height()); |
| 1252 return false; | 1252 return false; |
| 1253 } | 1253 } |
| 1254 memcpy(tmpBitmap.getPixels(), dstM.fImage, dstM.computeImageSize()); | 1254 memcpy(tmpBitmap.getPixels(), dstM.fImage, dstM.computeImageSize()); |
| 1255 if (offset) { | 1255 if (offset) { |
| 1256 offset->set(dstM.fBounds.fLeft, dstM.fBounds.fTop); | 1256 offset->set(dstM.fBounds.fLeft, dstM.fBounds.fTop); |
| 1257 } | 1257 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 SkASSERT(fPixelRef->rowBytes() >= fInfo.minRowBytes()); | 1430 SkASSERT(fPixelRef->rowBytes() >= fInfo.minRowBytes()); |
| 1431 } else { | 1431 } else { |
| 1432 SkASSERT(NULL == fColorTable); | 1432 SkASSERT(NULL == fColorTable); |
| 1433 } | 1433 } |
| 1434 } | 1434 } |
| 1435 #endif | 1435 #endif |
| 1436 | 1436 |
| 1437 #ifndef SK_IGNORE_TO_STRING | 1437 #ifndef SK_IGNORE_TO_STRING |
| 1438 void SkBitmap::toString(SkString* str) const { | 1438 void SkBitmap::toString(SkString* str) const { |
| 1439 | 1439 |
| 1440 static const char* gConfigNames[kConfigCount] = { | 1440 static const char* gColorTypeNames[kLastEnum_SkColorType + 1] = { |
| 1441 "NONE", "A8", "INDEX8", "565", "4444", "8888" | 1441 "UNKNOWN", "A8", "565", "4444", "RGBA", "BGRA", "INDEX8", |
| 1442 }; | 1442 }; |
| 1443 | 1443 |
| 1444 str->appendf("bitmap: ((%d, %d) %s", this->width(), this->height(), | 1444 str->appendf("bitmap: ((%d, %d) %s", this->width(), this->height(), |
| 1445 gConfigNames[this->config()]); | 1445 gColorTypeNames[this->colorType()]); |
| 1446 | 1446 |
| 1447 str->append(" ("); | 1447 str->append(" ("); |
| 1448 if (this->isOpaque()) { | 1448 if (this->isOpaque()) { |
| 1449 str->append("opaque"); | 1449 str->append("opaque"); |
| 1450 } else { | 1450 } else { |
| 1451 str->append("transparent"); | 1451 str->append("transparent"); |
| 1452 } | 1452 } |
| 1453 if (this->isImmutable()) { | 1453 if (this->isImmutable()) { |
| 1454 str->append(", immutable"); | 1454 str->append(", immutable"); |
| 1455 } else { | 1455 } else { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1477 /////////////////////////////////////////////////////////////////////////////// | 1477 /////////////////////////////////////////////////////////////////////////////// |
| 1478 | 1478 |
| 1479 #ifdef SK_DEBUG | 1479 #ifdef SK_DEBUG |
| 1480 void SkImageInfo::validate() const { | 1480 void SkImageInfo::validate() const { |
| 1481 SkASSERT(fWidth >= 0); | 1481 SkASSERT(fWidth >= 0); |
| 1482 SkASSERT(fHeight >= 0); | 1482 SkASSERT(fHeight >= 0); |
| 1483 SkASSERT(SkColorTypeIsValid(fColorType)); | 1483 SkASSERT(SkColorTypeIsValid(fColorType)); |
| 1484 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1484 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
| 1485 } | 1485 } |
| 1486 #endif | 1486 #endif |
| OLD | NEW |