OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 #ifndef SkBitmap_DEFINED | 10 #ifndef SkBitmap_DEFINED |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 fColors = fCTable ? fCTable->lockColors() : NULL; | 741 fColors = fCTable ? fCTable->lockColors() : NULL; |
742 } | 742 } |
743 /** Initialize with a colortable (may be null) | 743 /** Initialize with a colortable (may be null) |
744 */ | 744 */ |
745 explicit SkAutoLockColors(SkColorTable* ctable) { | 745 explicit SkAutoLockColors(SkColorTable* ctable) { |
746 fCTable = ctable; | 746 fCTable = ctable; |
747 fColors = ctable ? ctable->lockColors() : NULL; | 747 fColors = ctable ? ctable->lockColors() : NULL; |
748 } | 748 } |
749 ~SkAutoLockColors() { | 749 ~SkAutoLockColors() { |
750 if (fCTable) { | 750 if (fCTable) { |
751 fCTable->unlockColors(false); | 751 fCTable->unlockColors(); |
752 } | 752 } |
753 } | 753 } |
754 | 754 |
755 /** Return the currently locked colors, or NULL if no bitmap's colortable | 755 /** Return the currently locked colors, or NULL if no bitmap's colortable |
756 is currently locked. | 756 is currently locked. |
757 */ | 757 */ |
758 const SkPMColor* colors() const { return fColors; } | 758 const SkPMColor* colors() const { return fColors; } |
759 | 759 |
760 /** Locks the table and returns is colors (assuming ctable is not null) and | 760 /** Locks the table and returns is colors (assuming ctable is not null) and |
761 unlocks the previous table if one was present | 761 unlocks the previous table if one was present |
762 */ | 762 */ |
763 const SkPMColor* lockColors(SkColorTable* ctable) { | 763 const SkPMColor* lockColors(SkColorTable* ctable) { |
764 if (fCTable) { | 764 if (fCTable) { |
765 fCTable->unlockColors(false); | 765 fCTable->unlockColors(); |
766 } | 766 } |
767 fCTable = ctable; | 767 fCTable = ctable; |
768 fColors = ctable ? ctable->lockColors() : NULL; | 768 fColors = ctable ? ctable->lockColors() : NULL; |
769 return fColors; | 769 return fColors; |
770 } | 770 } |
771 | 771 |
772 const SkPMColor* lockColors(const SkBitmap& bm) { | 772 const SkPMColor* lockColors(const SkBitmap& bm) { |
773 return this->lockColors(bm.getColorTable()); | 773 return this->lockColors(bm.getColorTable()); |
774 } | 774 } |
775 | 775 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 811 |
812 // returns the address of the byte that contains the x coordinate | 812 // returns the address of the byte that contains the x coordinate |
813 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 813 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
814 SkASSERT(fPixels); | 814 SkASSERT(fPixels); |
815 SkASSERT(fConfig == kA1_Config); | 815 SkASSERT(fConfig == kA1_Config); |
816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 816 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
817 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 817 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
818 } | 818 } |
819 | 819 |
820 #endif | 820 #endif |
OLD | NEW |