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 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkColorTable.h" | 12 #include "SkColorTable.h" |
13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
14 #include "SkPoint.h" | 14 #include "SkPoint.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 | 16 |
| 17 struct SkMask; |
17 struct SkIRect; | 18 struct SkIRect; |
18 struct SkRect; | 19 struct SkRect; |
19 class SkPaint; | 20 class SkPaint; |
20 class SkPixelRef; | 21 class SkPixelRef; |
21 class SkPixelRefFactory; | 22 class SkPixelRefFactory; |
22 class SkRegion; | 23 class SkRegion; |
23 class SkString; | 24 class SkString; |
24 | 25 |
25 class GrTexture; | 26 class GrTexture; |
26 | 27 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 /** | 301 /** |
301 * Install a pixelref that wraps the specified pixels and rowBytes, and | 302 * Install a pixelref that wraps the specified pixels and rowBytes, and |
302 * optional ReleaseProc and context. When the pixels are no longer | 303 * optional ReleaseProc and context. When the pixels are no longer |
303 * referenced, if ReleaseProc is not null, it will be called with the | 304 * referenced, if ReleaseProc is not null, it will be called with the |
304 * pixels and context as parameters. | 305 * pixels and context as parameters. |
305 * On failure, the bitmap will be set to empty and return false. | 306 * On failure, the bitmap will be set to empty and return false. |
306 */ | 307 */ |
307 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, | 308 bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes, |
308 void (*ReleaseProc)(void* addr, void* context), | 309 void (*ReleaseProc)(void* addr, void* context), |
309 void* context); | 310 void* context); |
| 311 |
| 312 /** |
| 313 * Call installPixels with no ReleaseProc specified. This means that the |
| 314 * caller must ensure that the specified pixels are valid for the lifetime |
| 315 * of the created bitmap (and its pixelRef). |
| 316 */ |
| 317 bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { |
| 318 return this->installPixels(info, pixels, rowBytes, NULL, NULL); |
| 319 } |
| 320 |
| 321 /** |
| 322 * Calls installPixels() with the value in the SkMask. The caller must |
| 323 * ensure that the specified mask pixels are valid for the lifetime |
| 324 * of the created bitmap (and its pixelRef). |
| 325 */ |
| 326 bool installMaskPixels(const SkMask&); |
310 | 327 |
311 /** | 328 /** |
312 * DEPRECATED: call info(). | 329 * DEPRECATED: call info(). |
313 */ | 330 */ |
314 bool asImageInfo(SkImageInfo* info) const { | 331 bool asImageInfo(SkImageInfo* info) const { |
315 // compatibility: return false for kUnknown | 332 // compatibility: return false for kUnknown |
316 if (kUnknown_SkColorType == this->colorType()) { | 333 if (kUnknown_SkColorType == this->colorType()) { |
317 return false; | 334 return false; |
318 } | 335 } |
319 if (info) { | 336 if (info) { |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 } | 915 } |
899 | 916 |
900 /////////////////////////////////////////////////////////////////////////////// | 917 /////////////////////////////////////////////////////////////////////////////// |
901 // | 918 // |
902 // Helpers until we can fully deprecate SkBitmap::Config | 919 // Helpers until we can fully deprecate SkBitmap::Config |
903 // | 920 // |
904 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); | 921 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); |
905 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); | 922 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); |
906 | 923 |
907 #endif | 924 #endif |
OLD | NEW |