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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 * "unknown" pixels. | 213 * "unknown" pixels. |
214 */ | 214 */ |
215 static bool ComputeIsOpaque(const SkBitmap&); | 215 static bool ComputeIsOpaque(const SkBitmap&); |
216 | 216 |
217 /** | 217 /** |
218 * Return the bitmap's bounds [0, 0, width, height] as an SkRect | 218 * Return the bitmap's bounds [0, 0, width, height] as an SkRect |
219 */ | 219 */ |
220 void getBounds(SkRect* bounds) const; | 220 void getBounds(SkRect* bounds) const; |
221 void getBounds(SkIRect* bounds) const; | 221 void getBounds(SkIRect* bounds) const; |
222 | 222 |
| 223 SkIRect bounds() const { return fInfo.bounds(); } |
| 224 SkISize dimensions() const { return fInfo.dimensions(); } |
| 225 |
223 bool setInfo(const SkImageInfo&, size_t rowBytes = 0); | 226 bool setInfo(const SkImageInfo&, size_t rowBytes = 0); |
224 | 227 |
225 /** | 228 /** |
226 * Allocate the bitmap's pixels to match the requested image info. If the F
actory | 229 * Allocate the bitmap's pixels to match the requested image info. If the F
actory |
227 * is non-null, call it to allcoate the pixelref. If the ImageInfo requires | 230 * is non-null, call it to allcoate the pixelref. If the ImageInfo requires |
228 * a colortable, then ColorTable must be non-null, and will be ref'd. | 231 * a colortable, then ColorTable must be non-null, and will be ref'd. |
229 * On failure, the bitmap will be set to empty and return false. | 232 * On failure, the bitmap will be set to empty and return false. |
230 */ | 233 */ |
231 bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo&, SkPixelRefFact
ory*, SkColorTable*); | 234 bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo&, SkPixelRefFact
ory*, SkColorTable*); |
232 | 235 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 877 |
875 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 878 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
876 SkASSERT(fPixels); | 879 SkASSERT(fPixels); |
877 SkASSERT(kIndex_8_SkColorType == this->colorType()); | 880 SkASSERT(kIndex_8_SkColorType == this->colorType()); |
878 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); | 881 SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)th
is->height()); |
879 SkASSERT(fColorTable); | 882 SkASSERT(fColorTable); |
880 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 883 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
881 } | 884 } |
882 | 885 |
883 #endif | 886 #endif |
OLD | NEW |