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

Unified Diff: include/core/SkPixelRef.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/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index d90e58719bb0b87f5bd3b5ce9b0dc4c90e056259..e3a98c579a302be2886b83e5db5496287263090f 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -14,6 +14,7 @@
#include "SkRefCnt.h"
#include "SkString.h"
#include "SkFlattenable.h"
+#include "SkImageInfo.h"
#include "SkTDArray.h"
#ifdef SK_DEBUG
@@ -52,6 +53,11 @@ public:
explicit SkPixelRef(SkBaseMutex* mutex = NULL);
virtual ~SkPixelRef();
+ /**
+ * Return the data's rowbytes. Will be 0 if the the lockCount is 0.
+ */
+ size_t rowBytes() const { return fRowBytes; }
+
/** Return the pixel memory returned from lockPixels, or null if the
lockCount is 0.
*/
@@ -231,7 +237,7 @@ protected:
/** Called when the lockCount goes from 0 to 1. The caller will have already
acquire a mutex for thread safety, so this method need not do that.
*/
- virtual void* onLockPixels(SkColorTable**) = 0;
+ virtual void* onLockPixels(SkImageInfo*, size_t* rowBytes, SkColorTable**) = 0;
scroggo 2013/11/19 18:17:09 Comments explaining the parameters would be nice.
/** Called when the lock count goes from 1 to 0. The caller will have
already acquire a mutex for thread safety, so this method need not do
that.
@@ -269,12 +275,13 @@ protected:
// only call from constructor. Flags this to always be locked, removing
// the need to grab the mutex and call onLockPixels/onUnlockPixels.
// Performance tweak to avoid those calls (esp. in multi-thread use case).
- void setPreLocked(void* pixels, SkColorTable* ctable);
+ void setPreLocked(void* pixels, size_t rowBytes, SkColorTable* ctable);
private:
SkBaseMutex* fMutex; // must remain in scope for the life of this object
void* fPixels;
SkColorTable* fColorTable; // we do not track ownership, subclass does
+ size_t fRowBytes;
int fLockCount;
mutable uint32_t fGenerationID;

Powered by Google App Engine
This is Rietveld 408576698