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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 this if you are handling ownership/lifetime of the pixel memory. | 281 this if you are handling ownership/lifetime of the pixel memory. |
282 | 282 |
283 If the bitmap retains a reference to the colortable (assuming it is | 283 If the bitmap retains a reference to the colortable (assuming it is |
284 not null) it will take care of incrementing the reference count. | 284 not null) it will take care of incrementing the reference count. |
285 | 285 |
286 @param pixels Address for the pixels, managed by the caller. | 286 @param pixels Address for the pixels, managed by the caller. |
287 @param ctable ColorTable (or null) that matches the specified pixels | 287 @param ctable ColorTable (or null) that matches the specified pixels |
288 */ | 288 */ |
289 void setPixels(void* p, SkColorTable* ctable = NULL); | 289 void setPixels(void* p, SkColorTable* ctable = NULL); |
290 | 290 |
| 291 /** |
| 292 * Install the specified pixelref into the bitmap, with an optional rect |
| 293 * for referencing a subset of the pixels in the pixelref. This sets the |
| 294 * config/width/height/alphatype of the bitmap to match the pixelref. |
| 295 * |
| 296 * The subset rect, if not null, is intersected with the bounds of the |
| 297 * pixelref (taken from its SkImageInfo). |
| 298 */ |
| 299 SkPixelRef* installPixelRef(SkPixelRef*, const SkIRect* subset = NULL); |
| 300 |
291 /** Copies the bitmap's pixels to the location pointed at by dst and returns | 301 /** Copies the bitmap's pixels to the location pointed at by dst and returns |
292 true if possible, returns false otherwise. | 302 true if possible, returns false otherwise. |
293 | 303 |
294 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy | 304 In the case when the dstRowBytes matches the bitmap's rowBytes, the copy |
295 may be made faster by copying over the dst's per-row padding (for all | 305 may be made faster by copying over the dst's per-row padding (for all |
296 rows but the last). By setting preserveDstPad to true the caller can | 306 rows but the last). By setting preserveDstPad to true the caller can |
297 disable this optimization and ensure that pixels in the padding are not | 307 disable this optimization and ensure that pixels in the padding are not |
298 overwritten. | 308 overwritten. |
299 | 309 |
300 Always returns false for RLE formats. | 310 Always returns false for RLE formats. |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 858 |
849 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { | 859 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { |
850 SkASSERT(fPixels); | 860 SkASSERT(fPixels); |
851 SkASSERT(fConfig == kIndex8_Config); | 861 SkASSERT(fConfig == kIndex8_Config); |
852 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 862 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
853 SkASSERT(fColorTable); | 863 SkASSERT(fColorTable); |
854 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; | 864 return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; |
855 } | 865 } |
856 | 866 |
857 #endif | 867 #endif |
OLD | NEW |