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