| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 * If the colortype is kUnknown_SkColorType, then 0 is returned. | 98 * If the colortype is kUnknown_SkColorType, then 0 is returned. |
| 99 */ | 99 */ |
| 100 int rowBytesAsPixels() const { | 100 int rowBytesAsPixels() const { |
| 101 return fRowBytes >> this->shiftPerPixel(); | 101 return fRowBytes >> this->shiftPerPixel(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Return the shift amount per pixel (i.e. 0 for 1-byte per pixel, 1 for 2-
bytes per pixel | 105 * Return the shift amount per pixel (i.e. 0 for 1-byte per pixel, 1 for 2-
bytes per pixel |
| 106 * colortypes, 2 for 4-bytes per pixel colortypes). Return 0 for kUnknown_S
kColorType. | 106 * colortypes, 2 for 4-bytes per pixel colortypes). Return 0 for kUnknown_S
kColorType. |
| 107 */ | 107 */ |
| 108 int shiftPerPixel() const { return this->bytesPerPixel() >> 1; } | 108 int shiftPerPixel() const { return this->fInfo.shiftPerPixel(); } |
| 109 | 109 |
| 110 /////////////////////////////////////////////////////////////////////////// | 110 /////////////////////////////////////////////////////////////////////////// |
| 111 | 111 |
| 112 /** Return true iff the bitmap has empty dimensions. | 112 /** Return true iff the bitmap has empty dimensions. |
| 113 * Hey! Before you use this, see if you really want to know drawsNothing()
instead. | 113 * Hey! Before you use this, see if you really want to know drawsNothing()
instead. |
| 114 */ | 114 */ |
| 115 bool empty() const { return fInfo.isEmpty(); } | 115 bool empty() const { return fInfo.isEmpty(); } |
| 116 | 116 |
| 117 /** Return true iff the bitmap has no pixelref. Note: this can return true e
ven if the | 117 /** Return true iff the bitmap has no pixelref. Note: this can return true e
ven if the |
| 118 * dimensions of the bitmap are > 0 (see empty()). | 118 * dimensions of the bitmap are > 0 (see empty()). |
| (...skipping 706 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 |