| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 bool canCopyTo(SkColorType colorType) const; | 640 bool canCopyTo(SkColorType colorType) const; |
| 641 | 641 |
| 642 /** Makes a deep copy of this bitmap, keeping the copied pixels | 642 /** Makes a deep copy of this bitmap, keeping the copied pixels |
| 643 * in the same domain as the source: If the src pixels are allocated for | 643 * in the same domain as the source: If the src pixels are allocated for |
| 644 * the cpu, then so will the dst. If the src pixels are allocated on the | 644 * the cpu, then so will the dst. If the src pixels are allocated on the |
| 645 * gpu (typically as a texture), the it will do the same for the dst. | 645 * gpu (typically as a texture), the it will do the same for the dst. |
| 646 * If the request cannot be fulfilled, returns false and dst is unmodified. | 646 * If the request cannot be fulfilled, returns false and dst is unmodified. |
| 647 */ | 647 */ |
| 648 bool deepCopyTo(SkBitmap* dst) const; | 648 bool deepCopyTo(SkBitmap* dst) const; |
| 649 | 649 |
| 650 #ifdef SK_SUPPORT_LEGACY_BUILDMIPMAP |
| 650 SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint") | 651 SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint") |
| 651 void buildMipMap(bool forceRebuild = false); | 652 void buildMipMap(bool forceRebuild = false) {} |
| 653 #endif |
| 652 | 654 |
| 653 #ifdef SK_BUILD_FOR_ANDROID | 655 #ifdef SK_BUILD_FOR_ANDROID |
| 654 bool hasHardwareMipMap() const { | 656 bool hasHardwareMipMap() const { |
| 655 return (fFlags & kHasHardwareMipMap_Flag) != 0; | 657 return (fFlags & kHasHardwareMipMap_Flag) != 0; |
| 656 } | 658 } |
| 657 | 659 |
| 658 void setHasHardwareMipMap(bool hasHardwareMipMap) { | 660 void setHasHardwareMipMap(bool hasHardwareMipMap) { |
| 659 if (hasHardwareMipMap) { | 661 if (hasHardwareMipMap) { |
| 660 fFlags |= kHasHardwareMipMap_Flag; | 662 fFlags |= kHasHardwareMipMap_Flag; |
| 661 } else { | 663 } else { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 } | 745 } |
| 744 | 746 |
| 745 private: | 747 private: |
| 746 uint8_t** fYPtrs; | 748 uint8_t** fYPtrs; |
| 747 int fHeight; | 749 int fHeight; |
| 748 }; | 750 }; |
| 749 | 751 |
| 750 SK_TO_STRING_NONVIRT() | 752 SK_TO_STRING_NONVIRT() |
| 751 | 753 |
| 752 private: | 754 private: |
| 753 struct MipMap; | |
| 754 mutable MipMap* fMipMap; | |
| 755 | |
| 756 mutable SkPixelRef* fPixelRef; | 755 mutable SkPixelRef* fPixelRef; |
| 757 mutable int fPixelLockCount; | 756 mutable int fPixelLockCount; |
| 758 // These are just caches from the locked pixelref | 757 // These are just caches from the locked pixelref |
| 759 mutable void* fPixels; | 758 mutable void* fPixels; |
| 760 mutable SkColorTable* fColorTable; // only meaningful for kIndex8 | 759 mutable SkColorTable* fColorTable; // only meaningful for kIndex8 |
| 761 | 760 |
| 762 SkIPoint fPixelRefOrigin; | 761 SkIPoint fPixelRefOrigin; |
| 763 | 762 |
| 764 enum Flags { | 763 enum Flags { |
| 765 kImageIsOpaque_Flag = 0x01, | 764 kImageIsOpaque_Flag = 0x01, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 791 static size_t ComputeSafeSize(Config config, | 790 static size_t ComputeSafeSize(Config config, |
| 792 uint32_t width, | 791 uint32_t width, |
| 793 uint32_t height, | 792 uint32_t height, |
| 794 size_t rowBytes); | 793 size_t rowBytes); |
| 795 | 794 |
| 796 /* Unreference any pixelrefs or colortables | 795 /* Unreference any pixelrefs or colortables |
| 797 */ | 796 */ |
| 798 void freePixels(); | 797 void freePixels(); |
| 799 void updatePixelsFromRef() const; | 798 void updatePixelsFromRef() const; |
| 800 | 799 |
| 801 static SkFixed ComputeMipLevel(SkFixed sx, SkFixed dy); | |
| 802 | |
| 803 /** Given scale factors sx, sy, determine the miplevel available in the | |
| 804 bitmap, and return it (this is the amount to shift matrix iterators | |
| 805 by). If dst is not null, it is set to the correct level. | |
| 806 */ | |
| 807 int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); | |
| 808 bool hasMipMap() const; | |
| 809 void freeMipMap(); | |
| 810 | |
| 811 friend struct SkBitmapProcState; | 800 friend struct SkBitmapProcState; |
| 812 }; | 801 }; |
| 813 | 802 |
| 814 class SkAutoLockPixels : SkNoncopyable { | 803 class SkAutoLockPixels : SkNoncopyable { |
| 815 public: | 804 public: |
| 816 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { | 805 SkAutoLockPixels(const SkBitmap& bm, bool doLock = true) : fBitmap(bm) { |
| 817 fDidLock = doLock; | 806 fDidLock = doLock; |
| 818 if (doLock) { | 807 if (doLock) { |
| 819 bm.lockPixels(); | 808 bm.lockPixels(); |
| 820 } | 809 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 907 } |
| 919 | 908 |
| 920 /////////////////////////////////////////////////////////////////////////////// | 909 /////////////////////////////////////////////////////////////////////////////// |
| 921 // | 910 // |
| 922 // Helpers until we can fully deprecate SkBitmap::Config | 911 // Helpers until we can fully deprecate SkBitmap::Config |
| 923 // | 912 // |
| 924 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); | 913 extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); |
| 925 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); | 914 extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); |
| 926 | 915 |
| 927 #endif | 916 #endif |
| OLD | NEW |