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 |
11 #define SkBitmap_DEFINED | 11 #define SkBitmap_DEFINED |
12 | 12 |
13 #include "Sk64.h" | 13 #include "Sk64.h" |
14 #include "SkAlpha.h" | 14 #include "SkAlpha.h" |
15 #include "SkColor.h" | 15 #include "SkColor.h" |
16 #include "SkColorTable.h" | 16 #include "SkColorTable.h" |
17 #include "SkPoint.h" | 17 #include "SkPoint.h" |
18 #include "SkRefCnt.h" | 18 #include "SkRefCnt.h" |
19 | 19 |
| 20 struct SkImageInfo; |
20 struct SkIRect; | 21 struct SkIRect; |
21 struct SkRect; | 22 struct SkRect; |
22 class SkPaint; | 23 class SkPaint; |
23 class SkPixelRef; | 24 class SkPixelRef; |
24 class SkRegion; | 25 class SkRegion; |
25 class SkString; | 26 class SkString; |
26 | 27 |
27 class GrTexture; | 28 class GrTexture; |
28 | 29 |
29 /** \class SkBitmap | 30 /** \class SkBitmap |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 ComputeRowBytes() is called to compute the optimal value. This resets | 253 ComputeRowBytes() is called to compute the optimal value. This resets |
253 any pixel/colortable ownership, just like reset(). | 254 any pixel/colortable ownership, just like reset(). |
254 */ | 255 */ |
255 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); | 256 bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
256 | 257 |
257 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { | 258 bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
258 return this->setConfig(config, width, height, rowBytes, | 259 return this->setConfig(config, width, height, rowBytes, |
259 kPremul_SkAlphaType); | 260 kPremul_SkAlphaType); |
260 } | 261 } |
261 | 262 |
| 263 bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); |
262 | 264 |
263 /** Use this to assign a new pixel address for an existing bitmap. This | 265 /** Use this to assign a new pixel address for an existing bitmap. This |
264 will automatically release any pixelref previously installed. Only call | 266 will automatically release any pixelref previously installed. Only call |
265 this if you are handling ownership/lifetime of the pixel memory. | 267 this if you are handling ownership/lifetime of the pixel memory. |
266 | 268 |
267 If the bitmap retains a reference to the colortable (assuming it is | 269 If the bitmap retains a reference to the colortable (assuming it is |
268 not null) it will take care of incrementing the reference count. | 270 not null) it will take care of incrementing the reference count. |
269 | 271 |
270 @param pixels Address for the pixels, managed by the caller. | 272 @param pixels Address for the pixels, managed by the caller. |
271 @param ctable ColorTable (or null) that matches the specified pixels | 273 @param ctable ColorTable (or null) that matches the specified pixels |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 | 823 |
822 // returns the address of the byte that contains the x coordinate | 824 // returns the address of the byte that contains the x coordinate |
823 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { | 825 inline uint8_t* SkBitmap::getAddr1(int x, int y) const { |
824 SkASSERT(fPixels); | 826 SkASSERT(fPixels); |
825 SkASSERT(fConfig == kA1_Config); | 827 SkASSERT(fConfig == kA1_Config); |
826 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); | 828 SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight); |
827 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); | 829 return (uint8_t*)fPixels + y * fRowBytes + (x >> 3); |
828 } | 830 } |
829 | 831 |
830 #endif | 832 #endif |
OLD | NEW |