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

Unified Diff: include/core/SkPixelRef.h

Issue 1074983003: add SkPixmap and external locking to bitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: include/core/SkPixelRef.h
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 8a1e3db2b672a049065e9184acae366dc580b181..7c3156ee743339a0c5ec32f3da06eaf278cb95c8 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -10,15 +10,15 @@
#include "SkAtomics.h"
#include "SkBitmap.h"
+#include "SkFilterQuality.h"
#include "SkImageInfo.h"
#include "SkMutex.h"
+#include "SkPixmap.h"
#include "SkRefCnt.h"
#include "SkSize.h"
#include "SkString.h"
#include "SkTDArray.h"
-//#define xed
-
#ifdef SK_DEBUG
/**
* Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref
@@ -193,6 +193,30 @@ public:
return this->onRefEncodedData();
}
+ struct LockRequest {
+ SkISize fSize;
+ SkFilterQuality fQuality;
+ };
+
+ struct LockResult {
+ void (*fUnlockProc)(void* ctx);
+ void* fUnlockContext;
+
+ SkColorTable* fCTable; // should be NULL unless colortype is kIndex8
+ const void* fPixels;
+ size_t fRowBytes;
+ SkISize fSize;
+
+ void unlock() {
+ if (fUnlockProc) {
+ fUnlockProc(fUnlockContext);
+ fUnlockProc = NULL; // can't unlock twice!
+ }
+ }
+ };
+
+ bool requestLock(const LockRequest&, LockResult*);
+
/** Are we really wrapping a texture instead of a bitmap?
*/
virtual GrTexture* getTexture() { return NULL; }
@@ -299,6 +323,8 @@ protected:
*/
virtual size_t getAllocatedSizeInBytes() const;
+ virtual bool onRequestLock(const LockRequest&, LockResult*);
+
/** Return the mutex associated with this pixelref. This value is assigned
in the constructor, and cannot change during the lifetime of the object.
*/
@@ -319,6 +345,8 @@ private:
LockRec fRec;
int fLockCount;
+ bool lockPixelsInsideMutex(LockRec* rec);
+
// Bottom bit indicates the Gen ID is unique.
bool genIDIsUnique() const { return SkToBool(fTaggedGenID.load() & 1); }
mutable SkAtomic<uint32_t> fTaggedGenID;
« no previous file with comments | « include/core/SkImageInfo.h ('k') | include/core/SkPixmap.h » ('j') | include/core/SkPixmap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698