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

Unified Diff: include/core/SkMallocPixelRef.h

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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
Index: include/core/SkMallocPixelRef.h
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index 2241a513e7ea223ac8ddeac340bf8f73ee92d2ca..63320f44110ed8873aa3f37b1254c412a076a2ae 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -21,18 +21,21 @@ public:
last owner of this pixelref is gone. If addr is NULL, sk_malloc_throw()
is called to allocate it.
*/
- SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable, bool ownPixels = true);
+ SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rowBytes,
scroggo 2013/11/19 18:17:09 We'll need to make sure we update Android to call
reed1 2013/11/20 20:21:36 The compiler will help :)
+ SkColorTable* ctable, bool ownPixels);
scroggo 2013/11/19 18:17:09 This problem already existed, but it is strange to
reed1 2013/11/20 20:21:36 I have an assert in the impl, requiring false for
virtual ~SkMallocPixelRef();
//! Return the allocation size for the pixels
- size_t getSize() const { return fSize; }
+ size_t computeSize() const {
+ return fInfo.fHeight * fRB;
scroggo 2013/11/19 18:17:09 Instead of (fInfo.fHeight - 1) * fRB + fInfo.fWidt
reed1 2013/11/20 20:21:36 Good comment. Bitmap has both sizes. Not sure if w
+ }
void* getAddr() const { return fStorage; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef)
protected:
// overrides from SkPixelRef
- virtual void* onLockPixels(SkColorTable**);
+ virtual void* onLockPixels(SkImageInfo*, size_t*, SkColorTable**);
virtual void onUnlockPixels();
SkMallocPixelRef(SkFlattenableReadBuffer& buffer);
@@ -40,8 +43,9 @@ protected:
private:
void* fStorage;
- size_t fSize;
SkColorTable* fCTable;
+ size_t fRB;
scroggo 2013/11/19 18:17:09 Can these be const?
reed1 2013/11/20 20:21:36 Good idea.
+ SkImageInfo fInfo;
bool fOwnPixels;
typedef SkPixelRef INHERITED;

Powered by Google App Engine
This is Rietveld 408576698