OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkBitmap_DEFINED | 10 #ifndef SkBitmap_DEFINED |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 * "unknown" pixels. | 230 * "unknown" pixels. |
231 */ | 231 */ |
232 static bool ComputeIsOpaque(const SkBitmap&); | 232 static bool ComputeIsOpaque(const SkBitmap&); |
233 | 233 |
234 /** | 234 /** |
235 * Return the bitmap's bounds [0, 0, width, height] as an SkRect | 235 * Return the bitmap's bounds [0, 0, width, height] as an SkRect |
236 */ | 236 */ |
237 void getBounds(SkRect* bounds) const; | 237 void getBounds(SkRect* bounds) const; |
238 void getBounds(SkIRect* bounds) const; | 238 void getBounds(SkIRect* bounds) const; |
239 | 239 |
240 static bool Config2ColorType(Config, SkColorType*); | |
mtklein
2013/12/05 17:43:04
Seems like this guy can be private or static in th
reed1
2013/12/05 18:44:14
It is called by other sections of our code, not ju
| |
241 | |
240 /** Set the bitmap's config and dimensions. If rowBytes is 0, then | 242 /** Set the bitmap's config and dimensions. If rowBytes is 0, then |
241 ComputeRowBytes() is called to compute the optimal value. This resets | 243 ComputeRowBytes() is called to compute the optimal value. This resets |
242 any pixel/colortable ownership, just like reset(). | 244 any pixel/colortable ownership, just like reset(). |
243 */ | 245 */ |
244 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); | 246 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
245 | 247 |
246 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { | 248 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
247 return this->setConfig(config, width, height, rowBytes, | 249 return this->setConfig(config, width, height, rowBytes, |
248 kPremul_SkAlphaType); | 250 kPremul_SkAlphaType); |
249 } | 251 } |
250 | 252 |
251 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); | 253 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); |
252 | 254 |
255 /** | |
256 * If the bitmap's config can be represented as SkImageInfo, return true, | |
257 * and if info is not-null, set it to the bitmap's info. If it cannot be | |
258 * represented as SkImageInfo, return false and ignore the info parameter. | |
259 */ | |
260 bool asImageInfo(SkImageInfo* info) const; | |
261 | |
253 /** Use this to assign a new pixel address for an existing bitmap. This | 262 /** Use this to assign a new pixel address for an existing bitmap. This |
254 will automatically release any pixelref previously installed. Only call | 263 will automatically release any pixelref previously installed. Only call |
255 this if you are handling ownership/lifetime of the pixel memory. | 264 this if you are handling ownership/lifetime of the pixel memory. |
256 | 265 |
257 If the bitmap retains a reference to the colortable (assuming it is | 266 If the bitmap retains a reference to the colortable (assuming it is |
258 not null) it will take care of incrementing the reference count. | 267 not null) it will take care of incrementing the reference count. |
259 | 268 |
260 @param pixels Address for the pixels, managed by the caller. | 269 @param pixels Address for the pixels, managed by the caller. |
261 @param ctable ColorTable (or null) that matches the specified pixels | 270 @param ctable ColorTable (or null) that matches the specified pixels |
262 */ | 271 */ |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 | 807 |
799 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 808 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
800 SkASSERT(fPixels); | 809 SkASSERT(fPixels); |
801 SkASSERT(fConfig == kIndex8_Config); | 810 SkASSERT(fConfig == kIndex8_Config); |
802 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 811 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
803 SkASSERT(fColorTable); | 812 SkASSERT(fColorTable); |
804 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 813 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
805 } | 814 } |
806 | 815 |
807 #endif | 816 #endif |
OLD | NEW |