aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-04-13 16:02:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-13 20:44:24 +0000
commit818580d81b4a80071b5150e0febdf2fbe3826413 (patch)
treed23a86ab087e85984bfd8cc5ff8f8646b39f331d /include
parentc756c7acfeddb65f8eaa3f59714d5de93368ec30 (diff)
remove code directly involved in lock/unlock in SkPixelRef
Bug: skia:6481 Change-Id: I3c301ad42b082e04e233aa32d77862036fe998fa Reviewed-on: https://skia-review.googlesource.com/13463 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkMallocPixelRef.h4
-rw-r--r--include/core/SkPixelRef.h72
2 files changed, 3 insertions, 73 deletions
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index a62da0e46b..e378da77ee 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -101,10 +101,6 @@ public:
protected:
~SkMallocPixelRef() override;
-#ifdef SK_SUPPORT_LEGACY_NO_ADDR_PIXELREF
- bool onNewLockPixels(LockRec*) override;
- void onUnlockPixels() override;
-#endif
size_t getAllocatedSizeInBytes() const override;
private:
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index 97aca19c6f..3a3d8b58a5 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -27,17 +27,11 @@ class SkDiscardableMemory;
/** \class SkPixelRef
- This class is the smart container for pixel memory, and is used with
- SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can
- access the actual pixel memory by calling lockPixels/unlockPixels.
-
+ This class is the smart container for pixel memory, and is used with SkBitmap.
This class can be shared/accessed between multiple threads.
*/
class SK_API SkPixelRef : public SkRefCnt {
public:
-#ifdef SK_SUPPORT_LEGACY_NO_ADDR_PIXELREF
- explicit SkPixelRef(const SkImageInfo&);
-#endif
explicit SkPixelRef(const SkImageInfo&, void* addr, size_t rowBytes,
sk_sp<SkColorTable> = nullptr);
virtual ~SkPixelRef();
@@ -46,15 +40,8 @@ public:
return fInfo;
}
- /** Return the pixel memory returned from lockPixels, or null if the
- lockCount is 0.
- */
void* pixels() const { return fRec.fPixels; }
-
- /** Return the current colorTable (if any) if pixels are locked, or null.
- */
SkColorTable* colorTable() const { return fRec.fColorTable; }
-
size_t rowBytes() const { return fRec.fRowBytes; }
/**
@@ -75,14 +62,8 @@ public:
}
};
- SkDEBUGCODE(bool isLocked() const { return fLockCount > 0; })
- SkDEBUGCODE(int getLockCount() const { return fLockCount; })
-
- /**
- * Call to access the pixel memory. Return true on success. Balance this
- * with a call to unlockPixels().
- */
- bool lockPixels();
+ bool lockPixels() { return true; }
+ void unlockPixels() {}
/**
* Call to access the pixel memory. On success, return true and fill out
@@ -91,12 +72,6 @@ public:
*/
bool lockPixels(LockRec* rec);
- /** Call to balanace a previous call to lockPixels(). Returns the pixels
- (or null) after the unlock. NOTE: lock calls can be nested, but the
- matching number of unlock calls must be made in order to free the
- memory (if the subclass implements caching/deferred-decoding.)
- */
- void unlockPixels();
/** Returns a non-zero, unique value corresponding to the pixels in this
pixelref. Each time the pixels are changed (and notifyPixelsChanged is
@@ -192,36 +167,6 @@ public:
virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
protected:
-#ifdef SK_SUPPORT_LEGACY_NO_ADDR_PIXELREF
- virtual
-#endif
- /**
- * On success, returns true and fills out the LockRec for the pixels. On
- * failure returns false and ignores the LockRec parameter.
- *
- * The caller will have already acquired a mutex for thread safety, so this
- * method need not do that.
- */
- bool onNewLockPixels(LockRec*) {
- SkASSERT(false); // should never be called
- return true;
- }
-
-#ifdef SK_SUPPORT_LEGACY_NO_ADDR_PIXELREF
- virtual
-#endif
- /**
- * Balancing the previous successful call to onNewLockPixels. The locked
- * pixel address will no longer be referenced, so the subclass is free to
- * move or discard that memory.
- *
- * The caller will have already acquired a mutex for thread safety, so this
- * method need not do that.
- */
- void onUnlockPixels() {
- SkASSERT(false); // should never be called
- }
-
// default impl does nothing.
virtual void onNotifyPixelsChanged();
@@ -245,13 +190,6 @@ protected:
*/
SkBaseMutex* mutex() const { return &fMutex; }
-#ifdef SK_SUPPORT_LEGACY_NO_ADDR_PIXELREF
- // 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*, size_t rowBytes, SkColorTable*);
-#endif
-
private:
mutable SkMutex fMutex;
@@ -261,10 +199,6 @@ private:
// LockRec is only valid if we're in a locked state (isLocked())
LockRec fRec;
- int fLockCount;
-
- bool lockPixelsInsideMutex();
- bool internalRequestLock(const LockRequest&, LockResult*);
// Bottom bit indicates the Gen ID is unique.
bool genIDIsUnique() const { return SkToBool(fTaggedGenID.load() & 1); }