| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 /** Copies the src bitmap into this bitmap. Ownership of the src bitmap's pi
xels remains | 73 /** Copies the src bitmap into this bitmap. Ownership of the src bitmap's pi
xels remains |
| 74 with the src bitmap. | 74 with the src bitmap. |
| 75 */ | 75 */ |
| 76 SkBitmap& operator=(const SkBitmap& src); | 76 SkBitmap& operator=(const SkBitmap& src); |
| 77 /** Swap the fields of the two bitmaps. This routine is guaranteed to never
fail or throw. | 77 /** Swap the fields of the two bitmaps. This routine is guaranteed to never
fail or throw. |
| 78 */ | 78 */ |
| 79 // This method is not exported to java. | 79 // This method is not exported to java. |
| 80 void swap(SkBitmap& other); | 80 void swap(SkBitmap& other); |
| 81 | 81 |
| 82 /** Return true iff the bitmap has empty dimensions. | 82 /** Return true iff the bitmap has empty dimensions. |
| 83 */ | 83 * Hey! Before you use this, see if you really want to know drawsNothing()
instead. |
| 84 */ |
| 84 bool empty() const { return 0 == fWidth || 0 == fHeight; } | 85 bool empty() const { return 0 == fWidth || 0 == fHeight; } |
| 85 | 86 |
| 86 /** Return true iff the bitmap has no pixelref. Note: this can return true e
ven if the | 87 /** Return true iff the bitmap has no pixelref. Note: this can return true e
ven if the |
| 87 dimensions of the bitmap are > 0 (see empty()). | 88 * dimensions of the bitmap are > 0 (see empty()). |
| 88 */ | 89 * Hey! Before you use this, see if you really want to know drawsNothing()
instead. |
| 90 */ |
| 89 bool isNull() const { return NULL == fPixelRef; } | 91 bool isNull() const { return NULL == fPixelRef; } |
| 90 | 92 |
| 93 /** Return true iff drawing this bitmap has no effect. |
| 94 */ |
| 95 bool drawsNothing() const { return this->empty() || this->isNull(); } |
| 96 |
| 91 /** Return the config for the bitmap. */ | 97 /** Return the config for the bitmap. */ |
| 92 Config config() const { return (Config)fConfig; } | 98 Config config() const { return (Config)fConfig; } |
| 93 | 99 |
| 94 SK_ATTR_DEPRECATED("use config()") | 100 SK_ATTR_DEPRECATED("use config()") |
| 95 Config getConfig() const { return this->config(); } | 101 Config getConfig() const { return this->config(); } |
| 96 | 102 |
| 97 /** Return the bitmap's width, in pixels. */ | 103 /** Return the bitmap's width, in pixels. */ |
| 98 int width() const { return fWidth; } | 104 int width() const { return fWidth; } |
| 99 | 105 |
| 100 /** Return the bitmap's height, in pixels. */ | 106 /** Return the bitmap's height, in pixels. */ |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 881 |
| 876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 882 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
| 877 SkASSERT(fPixels); | 883 SkASSERT(fPixels); |
| 878 SkASSERT(fConfig == kIndex8_Config); | 884 SkASSERT(fConfig == kIndex8_Config); |
| 879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 885 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
| 880 SkASSERT(fColorTable); | 886 SkASSERT(fColorTable); |
| 881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 887 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
| 882 } | 888 } |
| 883 | 889 |
| 884 #endif | 890 #endif |
| OLD | NEW |