| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 * | 666 * |
| 667 * Note: if this returns true, the results (in the pixmap) are only valid u
ntil the bitmap | 667 * Note: if this returns true, the results (in the pixmap) are only valid u
ntil the bitmap |
| 668 * is changed in anyway, in which case the results are invalid. | 668 * is changed in anyway, in which case the results are invalid. |
| 669 */ | 669 */ |
| 670 bool peekPixels(SkPixmap*) const; | 670 bool peekPixels(SkPixmap*) const; |
| 671 | 671 |
| 672 SkDEBUGCODE(void validate() const;) | 672 SkDEBUGCODE(void validate() const;) |
| 673 | 673 |
| 674 class Allocator : public SkRefCnt { | 674 class Allocator : public SkRefCnt { |
| 675 public: | 675 public: |
| 676 SK_DECLARE_INST_COUNT(Allocator) | |
| 677 | |
| 678 /** Allocate the pixel memory for the bitmap, given its dimensions and | 676 /** Allocate the pixel memory for the bitmap, given its dimensions and |
| 679 colortype. Return true on success, where success means either setPix
els | 677 colortype. Return true on success, where success means either setPix
els |
| 680 or setPixelRef was called. The pixels need not be locked when this | 678 or setPixelRef was called. The pixels need not be locked when this |
| 681 returns. If the colortype requires a colortable, it also must be | 679 returns. If the colortype requires a colortable, it also must be |
| 682 installed via setColorTable. If false is returned, the bitmap and | 680 installed via setColorTable. If false is returned, the bitmap and |
| 683 colortable should be left unchanged. | 681 colortable should be left unchanged. |
| 684 */ | 682 */ |
| 685 virtual bool allocPixelRef(SkBitmap*, SkColorTable*) = 0; | 683 virtual bool allocPixelRef(SkBitmap*, SkColorTable*) = 0; |
| 686 private: | 684 private: |
| 687 typedef SkRefCnt INHERITED; | 685 typedef SkRefCnt INHERITED; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 801 |
| 804 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 802 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 805 SkASSERT(fPixels); | 803 SkASSERT(fPixels); |
| 806 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 804 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
| 807 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 805 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
| 808 SkASSERT(fColorTable); | 806 SkASSERT(fColorTable); |
| 809 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 807 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 810 } | 808 } |
| 811 | 809 |
| 812 #endif | 810 #endif |
| OLD | NEW |