aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-05-23 13:21:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-23 13:21:07 -0700
commit95d343f4083570a670a2d2121d5b5257ed36fbde (patch)
tree8ac2d488890d3c2d76258aed4d27f1682c6fd2dd /include
parentc240e719b2bebd3711ade4e6fe056921aa7b0521 (diff)
move readPixels from bitmap -> pixmap
BUG=skia: TBR= Review URL: https://codereview.chromium.org/1153893003
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPixmap.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h
index a2ce6cd788..3b554cf7ac 100644
--- a/include/core/SkPixmap.h
+++ b/include/core/SkPixmap.h
@@ -44,7 +44,8 @@ public:
SkAlphaType alphaType() const { return fInfo.alphaType(); }
bool isOpaque() const { return fInfo.isOpaque(); }
- int64_t getSafeSize64() const { return fInfo.getSafeSize64(fRowBytes); }
+ uint64_t getSize64() const { return sk_64_mul(fInfo.height(), fRowBytes); }
+ uint64_t getSafeSize64() const { return fInfo.getSafeSize64(fRowBytes); }
size_t getSafeSize() const { return fInfo.getSafeSize(fRowBytes); }
const uint32_t* addr32() const {
@@ -94,6 +95,20 @@ public:
return const_cast<uint8_t*>(this->addr8(x, y));
}
+ // copy methods
+
+ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
+ int srcX, int srcY) const;
+ bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const {
+ return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0);
+ }
+ bool readPixels(const SkPixmap& dst, int srcX, int srcY) const {
+ return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), srcX, srcY);
+ }
+ bool readPixels(const SkPixmap& dst) const {
+ return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), 0, 0);
+ }
+
private:
const void* fPixels;
SkColorTable* fCTable;