| 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 SkMask_DEFINED | 10 #ifndef SkMask_DEFINED |
| 11 #define SkMask_DEFINED | 11 #define SkMask_DEFINED |
| 12 | 12 |
| 13 #include "SkDiscardableMemory.h" |
| 13 #include "SkRect.h" | 14 #include "SkRect.h" |
| 14 | 15 |
| 15 /** \class SkMask | 16 /** \class SkMask |
| 16 SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or | 17 SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or |
| 17 the 3-channel 3D format. These are passed to SkMaskFilter objects. | 18 the 3-channel 3D format. These are passed to SkMaskFilter objects. |
| 18 */ | 19 */ |
| 19 struct SkMask { | 20 struct SkMask { |
| 20 enum Format { | 21 enum Format { |
| 21 kBW_Format, //!< 1bit per pixel mask (e.g. monochrome) | 22 kBW_Format, //!< 1bit per pixel mask (e.g. monochrome) |
| 22 kA8_Format, //!< 8bits per pixel mask (e.g. antialiasing) | 23 kA8_Format, //!< 8bits per pixel mask (e.g. antialiasing) |
| 23 k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add | 24 k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add |
| 24 kARGB32_Format, //!< SkPMColor | 25 kARGB32_Format, //!< SkPMColor |
| 25 kLCD16_Format, //!< 565 alpha for r/g/b | 26 kLCD16_Format, //!< 565 alpha for r/g/b |
| 26 kLCD32_Format //!< 888 alpha for r/g/b | 27 kLCD32_Format //!< 888 alpha for r/g/b |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 enum { | 30 enum { |
| 30 kCountMaskFormats = kLCD32_Format + 1 | 31 kCountMaskFormats = kLCD32_Format + 1 |
| 31 }; | 32 }; |
| 32 | 33 |
| 34 SkDiscardableMemory* fDiscardableMemory; |
| 35 bool fUseDiscardableMemory; |
| 33 uint8_t* fImage; | 36 uint8_t* fImage; |
| 34 SkIRect fBounds; | 37 SkIRect fBounds; |
| 35 uint32_t fRowBytes; | 38 uint32_t fRowBytes; |
| 36 Format fFormat; | 39 Format fFormat; |
| 37 | 40 |
| 38 /** Returns true if the mask is empty: i.e. it has an empty bounds. | 41 /** Returns true if the mask is empty: i.e. it has an empty bounds. |
| 39 */ | 42 */ |
| 40 bool isEmpty() const { return fBounds.isEmpty(); } | 43 bool isEmpty() const { return fBounds.isEmpty(); } |
| 41 | 44 |
| 42 /** Return the byte size of the mask, assuming only 1 plane. | 45 /** Return the byte size of the mask, assuming only 1 plane. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ~SkAutoMaskFreeImage() { | 156 ~SkAutoMaskFreeImage() { |
| 154 SkMask::FreeImage(fImage); | 157 SkMask::FreeImage(fImage); |
| 155 } | 158 } |
| 156 | 159 |
| 157 private: | 160 private: |
| 158 uint8_t* fImage; | 161 uint8_t* fImage; |
| 159 }; | 162 }; |
| 160 #define SkAutoMaskFreeImage(...) SK_REQUIRE_LOCAL_VAR(SkAutoMaskFreeImage) | 163 #define SkAutoMaskFreeImage(...) SK_REQUIRE_LOCAL_VAR(SkAutoMaskFreeImage) |
| 161 | 164 |
| 162 #endif | 165 #endif |
| OLD | NEW |