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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 */ | 249 */ |
250 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); | 250 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
251 | 251 |
252 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { | 252 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
253 return this->setConfig(config, width, height, rowBytes, | 253 return this->setConfig(config, width, height, rowBytes, |
254 kPremul_SkAlphaType); | 254 kPremul_SkAlphaType); |
255 } | 255 } |
256 | 256 |
257 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); | 257 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); |
258 | 258 |
| 259 /** |
| 260 * If the bitmap's config can be represented as SkImageInfo, return true, |
| 261 * and if info is not-null, set it to the bitmap's info. If it cannot be |
| 262 * represented as SkImageInfo, return false and ignore the info parameter. |
| 263 */ |
| 264 bool asImageInfo(SkImageInfo* info) const; |
| 265 |
259 /** Use this to assign a new pixel address for an existing bitmap. This | 266 /** Use this to assign a new pixel address for an existing bitmap. This |
260 will automatically release any pixelref previously installed. Only call | 267 will automatically release any pixelref previously installed. Only call |
261 this if you are handling ownership/lifetime of the pixel memory. | 268 this if you are handling ownership/lifetime of the pixel memory. |
262 | 269 |
263 If the bitmap retains a reference to the colortable (assuming it is | 270 If the bitmap retains a reference to the colortable (assuming it is |
264 not null) it will take care of incrementing the reference count. | 271 not null) it will take care of incrementing the reference count. |
265 | 272 |
266 @param pixels Address for the pixels, managed by the caller. | 273 @param pixels Address for the pixels, managed by the caller. |
267 @param ctable ColorTable (or null) that matches the specified pixels | 274 @param ctable ColorTable (or null) that matches the specified pixels |
268 */ | 275 */ |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 | 827 |
821 // returns the address of the byte that contains the x coordinate | 828 // returns the address of the byte that contains the x coordinate |
822 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 829 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
823 SkASSERT(fPixels); | 830 SkASSERT(fPixels); |
824 SkASSERT(fConfig == kA1_Config); | 831 SkASSERT(fConfig == kA1_Config); |
825 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 832 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
826 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 833 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
827 } | 834 } |
828 | 835 |
829 #endif | 836 #endif |
OLD | NEW |