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 SkMask; |
18 struct SkIRect; | 18 struct SkIRect; |
19 struct SkRect; | 19 struct SkRect; |
20 class SkPaint; | 20 class SkPaint; |
21 class SkPixelRef; | 21 class SkPixelRef; |
22 class SkPixelRefFactory; | 22 class SkPixelRefFactory; |
23 class SkRegion; | 23 class SkRegion; |
24 class SkString; | 24 class SkString; |
25 | 25 |
| 26 #define SK_SUPPORT_DEEPCOPYTO_CONFIG |
| 27 |
26 class GrTexture; | 28 class GrTexture; |
27 | 29 |
28 /** \class SkBitmap | 30 /** \class SkBitmap |
29 | 31 |
30 The SkBitmap class specifies a raster bitmap. A bitmap has an integer width | 32 The SkBitmap class specifies a raster bitmap. A bitmap has an integer width |
31 and height, and a format (config), and a pointer to the actual pixels. | 33 and height, and a format (config), and a pointer to the actual pixels. |
32 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the | 34 Bitmaps can be drawn into a SkCanvas, but they are also used to specify the |
33 target of a SkCanvas' drawing operations. | 35 target of a SkCanvas' drawing operations. |
34 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; | 36 A const SkBitmap exposes getAddr(), which lets a caller write its pixels; |
35 the constness is considered to apply to the bitmap's configuration, not | 37 the constness is considered to apply to the bitmap's configuration, not |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 */ | 632 */ |
631 bool copyTo(SkBitmap* dst, Config c, Allocator* allocator = NULL) const; | 633 bool copyTo(SkBitmap* dst, Config c, Allocator* allocator = NULL) const; |
632 | 634 |
633 /** Makes a deep copy of this bitmap, respecting the requested config, and | 635 /** Makes a deep copy of this bitmap, respecting the requested config, and |
634 * with custom allocation logic that will keep the copied pixels | 636 * with custom allocation logic that will keep the copied pixels |
635 * in the same domain as the source: If the src pixels are allocated for | 637 * in the same domain as the source: If the src pixels are allocated for |
636 * the cpu, then so will the dst. If the src pixels are allocated on the | 638 * the cpu, then so will the dst. If the src pixels are allocated on the |
637 * gpu (typically as a texture), the it will do the same for the dst. | 639 * gpu (typically as a texture), the it will do the same for the dst. |
638 * If the request cannot be fulfilled, returns false and dst is unmodified. | 640 * If the request cannot be fulfilled, returns false and dst is unmodified. |
639 */ | 641 */ |
| 642 #ifndef SK_SUPPORT_DEEPCOPYTO_CONFIG |
| 643 private: |
| 644 #endif |
640 bool deepCopyTo(SkBitmap* dst, Config c) const; | 645 bool deepCopyTo(SkBitmap* dst, Config c) const; |
| 646 public: |
| 647 |
| 648 /** Makes a deep copy of this bitmap, keeping the copied pixels |
| 649 * in the same domain as the source: If the src pixels are allocated for |
| 650 * the cpu, then so will the dst. If the src pixels are allocated on the |
| 651 * gpu (typically as a texture), the it will do the same for the dst. |
| 652 * If the request cannot be fulfilled, returns false and dst is unmodified. |
| 653 */ |
| 654 bool deepCopyTo(SkBitmap* dst) const; |
641 | 655 |
642 /** Returns true if this bitmap can be deep copied into the requested config | 656 /** Returns true if this bitmap can be deep copied into the requested config |
643 by calling copyTo(). | 657 by calling copyTo(). |
644 */ | 658 */ |
645 bool canCopyTo(Config newConfig) const; | 659 bool canCopyTo(Config newConfig) const; |
646 | 660 |
647 SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint") | 661 SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint") |
648 void buildMipMap(bool forceRebuild = false); | 662 void buildMipMap(bool forceRebuild = false); |
649 | 663 |
650 #ifdef SK_BUILD_FOR_ANDROID | 664 #ifdef SK_BUILD_FOR_ANDROID |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 } | 929 } |
916 | 930 |
917 /////////////////////////////////////////////////////////////////////////////// | 931 /////////////////////////////////////////////////////////////////////////////// |
918 // | 932 // |
919 // Helpers until we can fully deprecate SkBitmap::Config | 933 // Helpers until we can fully deprecate SkBitmap::Config |
920 // | 934 // |
921 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); | 935 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); |
922 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); | 936 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); |
923 | 937 |
924 #endif | 938 #endif |
OLD | NEW |