add SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR, initially always on

BUG=

Review URL: https://codereview.chromium.org/106183007

git-svn-id: http://skia.googlecode.com/svn/trunk@12552 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-12-06 22:07:17 +00:00
parent 2ebc10dd12
commit f1715706f7
2 changed files with 31 additions and 0 deletions

View File

@ -16,6 +16,8 @@
#include "SkFlattenable.h"
#include "SkTDArray.h"
#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
#ifdef SK_DEBUG
/**
* Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref
@ -49,7 +51,13 @@ class SK_API SkPixelRef : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkPixelRef)
#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
// DEPRECATED -- use a constructor that takes SkImageInfo
explicit SkPixelRef(SkBaseMutex* mutex = NULL);
#endif
explicit SkPixelRef(const SkImageInfo&);
explicit SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex);
virtual ~SkPixelRef();
/** Return the pixel memory returned from lockPixels, or null if the

View File

@ -82,6 +82,28 @@ void SkPixelRef::setMutex(SkBaseMutex* mutex) {
// just need a > 0 value, so pick a funny one to aid in debugging
#define SKPIXELREF_PRELOCKED_LOCKCOUNT 123456789
SkPixelRef::SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex) {
this->setMutex(mutex);
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;
this->needsNewGenID();
fIsImmutable = false;
fPreLocked = false;
}
SkPixelRef::SkPixelRef(const SkImageInfo&) {
this->setMutex(NULL);
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;
this->needsNewGenID();
fIsImmutable = false;
fPreLocked = false;
}
#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
// THIS GUY IS DEPRECATED -- don't use me!
SkPixelRef::SkPixelRef(SkBaseMutex* mutex) {
this->setMutex(mutex);
fPixels = NULL;
@ -91,6 +113,7 @@ SkPixelRef::SkPixelRef(SkBaseMutex* mutex) {
fIsImmutable = false;
fPreLocked = false;
}
#endif
SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
: INHERITED(buffer) {