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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 SkAlphaType alphaType() const { return (SkAlphaType)fAlphaType; } | 125 SkAlphaType alphaType() const { return (SkAlphaType)fAlphaType; } |
126 | 126 |
127 /** | 127 /** |
128 * Set the bitmap's alphaType, returning true on success. If false is | 128 * Set the bitmap's alphaType, returning true on success. If false is |
129 * returned, then the specified new alphaType is incompatible with the | 129 * returned, then the specified new alphaType is incompatible with the |
130 * Config, and the current alphaType is unchanged. | 130 * Config, and the current alphaType is unchanged. |
131 * | 131 * |
132 * Note: this changes the alphatype for the underlying pixels, which means | 132 * Note: this changes the alphatype for the underlying pixels, which means |
133 * that all bitmaps that might be sharing (subsets of) the pixels will | 133 * that all bitmaps that might be sharing (subsets of) the pixels will |
134 * be affected. This is an expensive change for some backends (e.g. GPU) | 134 * be affected. |
135 * since changing the alphatype can invalidate internal caches. Thus this | |
136 * call should only be made if it is associated with real changes to the | |
137 * pixel data. | |
138 */ | 135 */ |
139 bool setAlphaType(SkAlphaType); | 136 bool setAlphaType(SkAlphaType); |
140 | 137 |
141 /** Return the address of the pixels for this SkBitmap. | 138 /** Return the address of the pixels for this SkBitmap. |
142 */ | 139 */ |
143 void* getPixels() const { return fPixels; } | 140 void* getPixels() const { return fPixels; } |
144 | 141 |
145 /** Return the byte size of the pixels, based on the height and rowBytes. | 142 /** Return the byte size of the pixels, based on the height and rowBytes. |
146 Note this truncates the result to 32bits. Call getSize64() to detect | 143 Note this truncates the result to 32bits. Call getSize64() to detect |
147 if the real size exceeds 32bits. | 144 if the real size exceeds 32bits. |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 875 |
879 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 876 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
880 SkASSERT(fPixels); | 877 SkASSERT(fPixels); |
881 SkASSERT(fConfig == kIndex8_Config); | 878 SkASSERT(fConfig == kIndex8_Config); |
882 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 879 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
883 SkASSERT(fColorTable); | 880 SkASSERT(fColorTable); |
884 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 881 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
885 } | 882 } |
886 | 883 |
887 #endif | 884 #endif |
OLD | NEW |