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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 case kNo_Config: | 529 case kNo_Config: |
530 return true; | 530 return true; |
531 | 531 |
532 case kA1_Config: | 532 case kA1_Config: |
533 case kA8_Config: | 533 case kA8_Config: |
534 case kARGB_4444_Config: | 534 case kARGB_4444_Config: |
535 case kARGB_8888_Config: | 535 case kARGB_8888_Config: |
536 return (fFlags & kImageIsOpaque_Flag) != 0; | 536 return (fFlags & kImageIsOpaque_Flag) != 0; |
537 | 537 |
538 case kIndex8_Config: { | 538 case kIndex8_Config: { |
539 bool isOpaque; | 539 uint32_t flags = 0; |
540 | 540 |
541 this->lockPixels(); | 541 this->lockPixels(); |
542 isOpaque = fColorTable && fColorTable->isOpaque(); | 542 // if lockPixels failed, we may not have a ctable ptr |
| 543 if (fColorTable) { |
| 544 flags = fColorTable->getFlags(); |
| 545 } |
543 this->unlockPixels(); | 546 this->unlockPixels(); |
544 return isOpaque; | 547 |
| 548 return (flags & SkColorTable::kColorsAreOpaque_Flag) != 0; |
545 } | 549 } |
546 | 550 |
547 case kRGB_565_Config: | 551 case kRGB_565_Config: |
548 return true; | 552 return true; |
549 | 553 |
550 default: | 554 default: |
551 SkDEBUGFAIL("unknown bitmap config pased to isOpaque"); | 555 SkDEBUGFAIL("unknown bitmap config pased to isOpaque"); |
552 return false; | 556 return false; |
553 } | 557 } |
554 } | 558 } |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 if (ct) { | 1487 if (ct) { |
1484 const SkPMColor* SK_RESTRICT table = ct->lockColors(); | 1488 const SkPMColor* SK_RESTRICT table = ct->lockColors(); |
1485 const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0); | 1489 const uint8_t* SK_RESTRICT s = src.getAddr8(0, 0); |
1486 while (--h >= 0) { | 1490 while (--h >= 0) { |
1487 for (int x = 0; x < w; x++) { | 1491 for (int x = 0; x < w; x++) { |
1488 alpha[x] = SkGetPackedA32(table[s[x]]); | 1492 alpha[x] = SkGetPackedA32(table[s[x]]); |
1489 } | 1493 } |
1490 s += rb; | 1494 s += rb; |
1491 alpha += alphaRowBytes; | 1495 alpha += alphaRowBytes; |
1492 } | 1496 } |
1493 ct->unlockColors(); | 1497 ct->unlockColors(false); |
1494 } | 1498 } |
1495 } else { // src is opaque, so just fill alpha[] with 0xFF | 1499 } else { // src is opaque, so just fill alpha[] with 0xFF |
1496 memset(alpha, 0xFF, h * alphaRowBytes); | 1500 memset(alpha, 0xFF, h * alphaRowBytes); |
1497 } | 1501 } |
1498 return true; | 1502 return true; |
1499 } | 1503 } |
1500 | 1504 |
1501 #include "SkPaint.h" | 1505 #include "SkPaint.h" |
1502 #include "SkMaskFilter.h" | 1506 #include "SkMaskFilter.h" |
1503 #include "SkMatrix.h" | 1507 #include "SkMatrix.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 if (NULL != uri) { | 1699 if (NULL != uri) { |
1696 str->appendf(" uri:\"%s\"", uri); | 1700 str->appendf(" uri:\"%s\"", uri); |
1697 } else { | 1701 } else { |
1698 str->appendf(" pixelref:%p", pr); | 1702 str->appendf(" pixelref:%p", pr); |
1699 } | 1703 } |
1700 } | 1704 } |
1701 | 1705 |
1702 str->append(")"); | 1706 str->append(")"); |
1703 } | 1707 } |
1704 #endif | 1708 #endif |
OLD | NEW |