OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkBitmap_DEFINED | 8 #ifndef SkBitmap_DEFINED |
9 #define SkBitmap_DEFINED | 9 #define SkBitmap_DEFINED |
10 | 10 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 uint8_t fFlags; | 767 uint8_t fFlags; |
768 | 768 |
769 /* Unreference any pixelrefs or colortables | 769 /* Unreference any pixelrefs or colortables |
770 */ | 770 */ |
771 void freePixels(); | 771 void freePixels(); |
772 void updatePixelsFromRef() const; | 772 void updatePixelsFromRef() const; |
773 | 773 |
774 static void WriteRawPixels(SkWriteBuffer*, const SkBitmap&); | 774 static void WriteRawPixels(SkWriteBuffer*, const SkBitmap&); |
775 static bool ReadRawPixels(SkReadBuffer*, SkBitmap*); | 775 static bool ReadRawPixels(SkReadBuffer*, SkBitmap*); |
776 | 776 |
777 friend class SkReadBuffer; // unflatten, rawpixels | 777 friend class SkReadBuffer; // unflatten, rawpixels |
778 friend class SkWriteBuffer; // rawpixels | 778 friend class SkBinaryWriteBuffer; // rawpixels |
779 friend struct SkBitmapProcState; | 779 friend struct SkBitmapProcState; |
780 }; | 780 }; |
781 | 781 |
782 class SkAutoLockPixels : SkNoncopyable { | 782 class SkAutoLockPixels : SkNoncopyable { |
783 public: | 783 public: |
784 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { | 784 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { |
785 fDidLock = doLock; | 785 fDidLock = doLock; |
786 if (doLock) { | 786 if (doLock) { |
787 bm.lockPixels(); | 787 bm.lockPixels(); |
788 } | 788 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 826 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
827 SkASSERT(fPixels); | 827 SkASSERT(fPixels); |
828 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 828 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
829 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 829 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
830 SkASSERT(fColorTable); | 830 SkASSERT(fColorTable); |
831 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 831 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
832 } | 832 } |
833 | 833 |
834 #endif | 834 #endif |
OLD | NEW |