| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 @param allocator Allocator used to allocate the pixelref for the dst | 647 @param allocator Allocator used to allocate the pixelref for the dst |
| 648 bitmap. If this is null, the standard HeapAllocator | 648 bitmap. If this is null, the standard HeapAllocator |
| 649 will be used. | 649 will be used. |
| 650 @param offset If not null, it is set to top-left coordinate to position | 650 @param offset If not null, it is set to top-left coordinate to position |
| 651 the returned bitmap so that it visually lines up with the | 651 the returned bitmap so that it visually lines up with the |
| 652 original | 652 original |
| 653 */ | 653 */ |
| 654 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, | 654 bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, |
| 655 SkIPoint* offset) const; | 655 SkIPoint* offset) const; |
| 656 | 656 |
| 657 /** |
| 658 * If the pixels are available from this bitmap (w/o locking) return true,
and fill out the |
| 659 * specified pixmap (if not null). If the pixels are not available (either
because there are |
| 660 * none, or becuase accessing them would require locking or other machinary
) return false and |
| 661 * ignore the pixmap parameter. |
| 662 * |
| 663 * Note: if this returns true, the results (in the pixmap) are only valid u
ntil the bitmap |
| 664 * is changed in anyway, in which case the results are invalid. |
| 665 */ |
| 666 bool peekPixels(SkPixmap*) const; |
| 667 |
| 657 SkDEBUGCODE(void validate() const;) | 668 SkDEBUGCODE(void validate() const;) |
| 658 | 669 |
| 659 class Allocator : public SkRefCnt { | 670 class Allocator : public SkRefCnt { |
| 660 public: | 671 public: |
| 661 SK_DECLARE_INST_COUNT(Allocator) | 672 SK_DECLARE_INST_COUNT(Allocator) |
| 662 | 673 |
| 663 /** Allocate the pixel memory for the bitmap, given its dimensions and | 674 /** Allocate the pixel memory for the bitmap, given its dimensions and |
| 664 colortype. Return true on success, where success means either setPix
els | 675 colortype. Return true on success, where success means either setPix
els |
| 665 or setPixelRef was called. The pixels need not be locked when this | 676 or setPixelRef was called. The pixels need not be locked when this |
| 666 returns. If the colortype requires a colortable, it also must be | 677 returns. If the colortype requires a colortable, it also must be |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 803 |
| 793 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 804 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 794 SkASSERT(fPixels); | 805 SkASSERT(fPixels); |
| 795 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 806 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
| 796 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 807 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
| 797 SkASSERT(fColorTable); | 808 SkASSERT(fColorTable); |
| 798 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 809 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 799 } | 810 } |
| 800 | 811 |
| 801 #endif | 812 #endif |
| OLD | NEW |