remove vestigle code for lockpixels
Bug: skia:6481 Change-Id: Icfd53981b8588fbea74fca2e3be58bc6f13ef923 Reviewed-on: https://skia-review.googlesource.com/13968 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
ad5a81b064
commit
ad8b5dc69c
@ -419,12 +419,6 @@ public:
|
||||
*/
|
||||
void setPixelRef(sk_sp<SkPixelRef>, int dx, int dy);
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
void lockPixels() const {}
|
||||
void unlockPixels() const {}
|
||||
bool requestLock(SkAutoPixmapUnlock* result) const;
|
||||
#endif
|
||||
|
||||
/** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
|
||||
it has non-null pixels, and if required by its colortype, it has a
|
||||
non-null colortable. Returns true if all of the above are met.
|
||||
@ -756,13 +750,6 @@ private:
|
||||
friend class SkBinaryWriteBuffer; // rawpixels
|
||||
};
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
class SkAutoLockPixels : SkNoncopyable {
|
||||
public:
|
||||
SkAutoLockPixels(const SkBitmap&, bool = true) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
|
||||
|
@ -43,59 +43,6 @@ public:
|
||||
SkColorTable* colorTable() const { return fCTable.get(); }
|
||||
size_t rowBytes() const { return fRowBytes; }
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
struct LockRec {
|
||||
LockRec() : fPixels(NULL), fColorTable(NULL) {}
|
||||
|
||||
void* fPixels;
|
||||
SkColorTable* fColorTable;
|
||||
size_t fRowBytes;
|
||||
|
||||
void zero() { sk_bzero(this, sizeof(*this)); }
|
||||
|
||||
bool isZero() const {
|
||||
return NULL == fPixels && NULL == fColorTable && 0 == fRowBytes;
|
||||
}
|
||||
};
|
||||
|
||||
bool lockPixels() { return true; }
|
||||
void unlockPixels() {}
|
||||
|
||||
/**
|
||||
* Call to access the pixel memory. On success, return true and fill out
|
||||
* the specified rec. On failure, return false and ignore the rec parameter.
|
||||
* Balance this with a call to unlockPixels().
|
||||
*/
|
||||
bool lockPixels(LockRec* rec);
|
||||
|
||||
struct LockRequest {
|
||||
SkISize fSize;
|
||||
SkFilterQuality fQuality;
|
||||
};
|
||||
|
||||
struct LockResult {
|
||||
LockResult() : fPixels(NULL), fCTable(NULL) {}
|
||||
|
||||
void (*fUnlockProc)(void* ctx);
|
||||
void* fUnlockContext;
|
||||
|
||||
const void* fPixels;
|
||||
SkColorTable* fCTable; // should be NULL unless colortype is kIndex8
|
||||
size_t fRowBytes;
|
||||
SkISize fSize;
|
||||
|
||||
void unlock() {
|
||||
if (fUnlockProc) {
|
||||
fUnlockProc(fUnlockContext);
|
||||
fUnlockProc = NULL; // can't unlock twice!
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool requestLock(const LockRequest&, LockResult*);
|
||||
#endif
|
||||
|
||||
|
||||
/** Returns a non-zero, unique value corresponding to the pixels in this
|
||||
pixelref. Each time the pixels are changed (and notifyPixelsChanged is
|
||||
called), a different generation ID will be returned.
|
||||
|
@ -219,54 +219,4 @@ private:
|
||||
SkImageInfo fInfo;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
class SK_API SkAutoPixmapUnlock : ::SkNoncopyable {
|
||||
public:
|
||||
SkAutoPixmapUnlock() : fUnlockProc(NULL), fIsLocked(false) {}
|
||||
SkAutoPixmapUnlock(const SkPixmap& pm, void (*unlock)(void*), void* ctx)
|
||||
: fUnlockProc(unlock), fUnlockContext(ctx), fPixmap(pm), fIsLocked(true)
|
||||
{}
|
||||
~SkAutoPixmapUnlock() { this->unlock(); }
|
||||
|
||||
/**
|
||||
* Return the currently locked pixmap. Undefined if it has been unlocked.
|
||||
*/
|
||||
const SkPixmap& pixmap() const {
|
||||
SkASSERT(this->isLocked());
|
||||
return fPixmap;
|
||||
}
|
||||
|
||||
bool isLocked() const { return fIsLocked; }
|
||||
|
||||
/**
|
||||
* Unlocks the pixmap. Can safely be called more than once as it will only call the underlying
|
||||
* unlock-proc once.
|
||||
*/
|
||||
void unlock() {
|
||||
if (fUnlockProc) {
|
||||
SkASSERT(fIsLocked);
|
||||
fUnlockProc(fUnlockContext);
|
||||
fUnlockProc = NULL;
|
||||
fIsLocked = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a currently locked pixmap, unlock it, then copy the specified pixmap
|
||||
* and (optional) unlock proc/context.
|
||||
*/
|
||||
void reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx);
|
||||
|
||||
private:
|
||||
void (*fUnlockProc)(void*);
|
||||
void* fUnlockContext;
|
||||
SkPixmap fPixmap;
|
||||
bool fIsLocked;
|
||||
|
||||
friend class SkBitmap;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -656,8 +656,6 @@ DEFINES_ALL = [
|
||||
# Staging flags for API changes
|
||||
# Temporarily Disable analytic AA for Google3
|
||||
"SK_NO_ANALYTIC_AA",
|
||||
"SK_SUPPORT_LEGACY_CANVAS_READPIXELS",
|
||||
"SK_SUPPORT_OBSOLETE_LOCKPIXELS",
|
||||
]
|
||||
|
||||
################################################################################
|
||||
|
@ -994,37 +994,6 @@ void SkBitmap::toString(SkString* str) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
bool SkBitmap::requestLock(SkAutoPixmapUnlock* result) const {
|
||||
SkASSERT(result);
|
||||
|
||||
SkPixelRef* pr = fPixelRef.get();
|
||||
if (nullptr == pr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We have to lock the whole thing (using the pixelref's dimensions) until the api supports
|
||||
// a partial lock (with offset/origin). Hence we can't use our fInfo.
|
||||
SkPixelRef::LockRequest req = { pr->info().dimensions(), kNone_SkFilterQuality };
|
||||
SkPixelRef::LockResult res;
|
||||
if (pr->requestLock(req, &res)) {
|
||||
SkASSERT(res.fPixels);
|
||||
// The bitmap may be a subset of the pixelref's dimensions
|
||||
SkASSERT(fPixelRefOrigin.x() + fInfo.width() <= res.fSize.width());
|
||||
SkASSERT(fPixelRefOrigin.y() + fInfo.height() <= res.fSize.height());
|
||||
const void* addr = (const char*)res.fPixels + SkColorTypeComputeOffset(fInfo.colorType(),
|
||||
fPixelRefOrigin.x(),
|
||||
fPixelRefOrigin.y(),
|
||||
res.fRowBytes);
|
||||
|
||||
result->reset(SkPixmap(this->info(), addr, res.fRowBytes, res.fCTable),
|
||||
res.fUnlockProc, res.fUnlockContext);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SkBitmap::peekPixels(SkPixmap* pmap) const {
|
||||
if (fPixels) {
|
||||
if (pmap) {
|
||||
|
@ -110,37 +110,6 @@ void SkPixelRef::cloneGenID(const SkPixelRef& that) {
|
||||
SkASSERT(!that. genIDIsUnique());
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
bool SkPixelRef::lockPixels(LockRec* rec) {
|
||||
if (fPixels) {
|
||||
rec->fPixels = fPixels;
|
||||
rec->fRowBytes = fRowBytes;
|
||||
rec->fColorTable = fCTable.get();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
|
||||
SkASSERT(result);
|
||||
if (request.fSize.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// until we support subsets, we have to check this...
|
||||
if (request.fSize.width() != fInfo.width() || request.fSize.height() != fInfo.height()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result->fUnlockProc = nullptr;
|
||||
result->fUnlockContext = nullptr;
|
||||
result->fCTable = fCTable.get();
|
||||
result->fPixels = fPixels;
|
||||
result->fRowBytes = fRowBytes;
|
||||
result->fSize.set(fInfo.width(), fInfo.height());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t SkPixelRef::getGenerationID() const {
|
||||
uint32_t id = fTaggedGenID.load();
|
||||
if (0 == id) {
|
||||
|
@ -20,18 +20,6 @@
|
||||
#include "SkSurface.h"
|
||||
#include "SkUtils.h"
|
||||
|
||||
#ifdef SK_SUPPORT_OBSOLETE_LOCKPIXELS
|
||||
void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx) {
|
||||
SkASSERT(pm.addr() != nullptr);
|
||||
|
||||
this->unlock();
|
||||
fPixmap = pm;
|
||||
fUnlockProc = unlock;
|
||||
fUnlockContext = ctx;
|
||||
fIsLocked = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SkPixmap::reset() {
|
||||
|
Loading…
Reference in New Issue
Block a user