| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 SkPixmap_DEFINED | 8 #ifndef SkPixmap_DEFINED |
| 9 #define SkPixmap_DEFINED | 9 #define SkPixmap_DEFINED |
| 10 | 10 |
| 11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkFilterQuality.h" |
| 12 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 13 | 14 |
| 14 class SkColorTable; | 15 class SkColorTable; |
| 15 struct SkMask; | 16 struct SkMask; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Pairs SkImageInfo with actual pixels and rowbytes. This class does not try t
o manage the | 19 * Pairs SkImageInfo with actual pixels and rowbytes. This class does not try t
o manage the |
| 19 * lifetime of the pixel memory (nor the colortable if provided). | 20 * lifetime of the pixel memory (nor the colortable if provided). |
| 20 */ | 21 */ |
| 21 class SK_API SkPixmap { | 22 class SK_API SkPixmap { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0); | 129 return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0); |
| 129 } | 130 } |
| 130 bool readPixels(const SkPixmap& dst, int srcX, int srcY) const { | 131 bool readPixels(const SkPixmap& dst, int srcX, int srcY) const { |
| 131 return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(),
srcX, srcY); | 132 return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(),
srcX, srcY); |
| 132 } | 133 } |
| 133 bool readPixels(const SkPixmap& dst) const { | 134 bool readPixels(const SkPixmap& dst) const { |
| 134 return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(),
0, 0); | 135 return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(),
0, 0); |
| 135 } | 136 } |
| 136 | 137 |
| 137 /** | 138 /** |
| 139 * Copy the pixels from this pixmap into the dst pixmap, converting as need
ed into dst's |
| 140 * colortype/alphatype. If the conversion cannot be performed, false is ret
urned. |
| 141 * |
| 142 * If dst's dimensions differ from the src dimension, the image will be sca
led, applying the |
| 143 * specified filter-quality. |
| 144 */ |
| 145 bool scalePixels(const SkPixmap& dst, SkFilterQuality) const; |
| 146 |
| 147 /** |
| 138 * Returns true if pixels were written to (e.g. if colorType is kUnknown_Sk
ColorType, this | 148 * Returns true if pixels were written to (e.g. if colorType is kUnknown_Sk
ColorType, this |
| 139 * will return false). If subset does not intersect the bounds of this pixm
ap, returns false. | 149 * will return false). If subset does not intersect the bounds of this pixm
ap, returns false. |
| 140 */ | 150 */ |
| 141 bool erase(SkColor, const SkIRect& subset) const; | 151 bool erase(SkColor, const SkIRect& subset) const; |
| 142 | 152 |
| 143 bool erase(SkColor color) const { return this->erase(color, this->bounds());
} | 153 bool erase(SkColor color) const { return this->erase(color, this->bounds());
} |
| 144 | 154 |
| 145 private: | 155 private: |
| 146 const void* fPixels; | 156 const void* fPixels; |
| 147 SkColorTable* fCTable; | 157 SkColorTable* fCTable; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 private: | 256 private: |
| 247 void (*fUnlockProc)(void*); | 257 void (*fUnlockProc)(void*); |
| 248 void* fUnlockContext; | 258 void* fUnlockContext; |
| 249 SkPixmap fPixmap; | 259 SkPixmap fPixmap; |
| 250 bool fIsLocked; | 260 bool fIsLocked; |
| 251 | 261 |
| 252 friend class SkBitmap; | 262 friend class SkBitmap; |
| 253 }; | 263 }; |
| 254 | 264 |
| 255 #endif | 265 #endif |
| OLD | NEW |