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; |