| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 * will be used. | 584 * will be used. |
| 585 * @return true if the copy was made. | 585 * @return true if the copy was made. |
| 586 */ | 586 */ |
| 587 bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const; | 587 bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const; |
| 588 | 588 |
| 589 bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const { | 589 bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const { |
| 590 return this->copyTo(dst, this->colorType(), allocator); | 590 return this->copyTo(dst, this->colorType(), allocator); |
| 591 } | 591 } |
| 592 | 592 |
| 593 /** | 593 /** |
| 594 * Copy the bitmap's pixels into the specified buffer (pixels + rowBytes), | |
| 595 * converting them into the requested format (SkImageInfo). The src pixels
are read | |
| 596 * starting at the specified (srcX,srcY) offset, relative to the top-left c
orner. | |
| 597 * | |
| 598 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle | |
| 599 * | |
| 600 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); | |
| 601 * | |
| 602 * srcR is intersected with the bounds of the bitmap. If this intersection
is not empty, | |
| 603 * then we have two sets of pixels (of equal size). Replace the dst pixels
with the | |
| 604 * corresponding src pixels, performing any colortype/alphatype transformat
ions needed | |
| 605 * (in the case where the src and dst have different colortypes or alphatyp
es). | |
| 606 * | |
| 607 * This call can fail, returning false, for several reasons: | |
| 608 * - If srcR does not intersect the bitmap bounds. | |
| 609 * - If the requested colortype/alphatype cannot be converted from the src'
s types. | |
| 610 * - If the src pixels are not available. | |
| 611 */ | |
| 612 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, | |
| 613 int srcX, int srcY) const; | |
| 614 | |
| 615 /** | |
| 616 * Returns true if this bitmap's pixels can be converted into the requested | 594 * Returns true if this bitmap's pixels can be converted into the requested |
| 617 * colorType, such that copyTo() could succeed. | 595 * colorType, such that copyTo() could succeed. |
| 618 */ | 596 */ |
| 619 bool canCopyTo(SkColorType colorType) const; | 597 bool canCopyTo(SkColorType colorType) const; |
| 620 | 598 |
| 621 /** Makes a deep copy of this bitmap, keeping the copied pixels | 599 /** Makes a deep copy of this bitmap, keeping the copied pixels |
| 622 * in the same domain as the source: If the src pixels are allocated for | 600 * in the same domain as the source: If the src pixels are allocated for |
| 623 * the cpu, then so will the dst. If the src pixels are allocated on the | 601 * the cpu, then so will the dst. If the src pixels are allocated on the |
| 624 * gpu (typically as a texture), the it will do the same for the dst. | 602 * gpu (typically as a texture), the it will do the same for the dst. |
| 625 * If the request cannot be fulfilled, returns false and dst is unmodified. | 603 * If the request cannot be fulfilled, returns false and dst is unmodified. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG | 848 #ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG |
| 871 /////////////////////////////////////////////////////////////////////////////// | 849 /////////////////////////////////////////////////////////////////////////////// |
| 872 // | 850 // |
| 873 // Helpers until we can fully deprecate SkBitmap::Config | 851 // Helpers until we can fully deprecate SkBitmap::Config |
| 874 // | 852 // |
| 875 SK_API SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); | 853 SK_API SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); |
| 876 SK_API SkColorType SkBitmapConfigToColorType(SkBitmap::Config); | 854 SK_API SkColorType SkBitmapConfigToColorType(SkBitmap::Config); |
| 877 #endif | 855 #endif |
| 878 | 856 |
| 879 #endif | 857 #endif |
| OLD | NEW |