Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: include/core/SkPixmap.h

Issue 1153893003: move readPixels from bitmap -> pixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPixmap.h
diff --git a/include/core/SkPixmap.h b/include/core/SkPixmap.h
index a2ce6cd7889fc10b73f34feb61ea00378da7d312..3b554cf7ac120ef4b88d365f6a73e7c565968022 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;
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698