remove SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR and make fInfo const

BUG=
R=halcanary@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12863 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2014-01-02 18:07:46 +00:00
parent 1bed687f6b
commit 33cc989f23
2 changed files with 11 additions and 29 deletions

View File

@ -16,8 +16,6 @@
#include "SkFlattenable.h"
#include "SkTDArray.h"
//#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
#ifdef SK_DEBUG
/**
* Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref
@ -51,11 +49,6 @@ 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&);
SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex);
virtual ~SkPixelRef();
@ -300,9 +293,8 @@ protected:
private:
SkBaseMutex* fMutex; // must remain in scope for the life of this object
// FIXME: fInfo should be const once we remove old constructor that does
// not set it.
SkImageInfo fInfo;
const SkImageInfo fInfo;
void* fPixels;
SkColorTable* fColorTable; // we do not track ownership, subclass does

View File

@ -82,9 +82,8 @@ 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& info, SkBaseMutex* mutex) {
SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) : fInfo(info) {
this->setMutex(mutex);
fInfo = info;
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;
@ -93,9 +92,8 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) {
fPreLocked = false;
}
SkPixelRef::SkPixelRef(const SkImageInfo& info) {
SkPixelRef::SkPixelRef(const SkImageInfo& info) : fInfo(info) {
this->setMutex(NULL);
fInfo = info;
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;
@ -104,25 +102,17 @@ SkPixelRef::SkPixelRef(const SkImageInfo& info) {
fPreLocked = false;
}
#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
// THIS GUY IS DEPRECATED -- don't use me!
SkPixelRef::SkPixelRef(SkBaseMutex* mutex) {
this->setMutex(mutex);
// Fill with dummy values.
sk_bzero(&fInfo, sizeof(fInfo));
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;
this->needsNewGenID();
fIsImmutable = false;
fPreLocked = false;
static SkImageInfo read_info(SkFlattenableReadBuffer& buffer) {
SkImageInfo info;
info.unflatten(buffer);
return info;
}
#endif
SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
: INHERITED(buffer) {
: INHERITED(buffer)
, fInfo(read_info(buffer))
{
this->setMutex(mutex);
fInfo.unflatten(buffer);
fPixels = NULL;
fColorTable = NULL; // we do not track ownership of this
fLockCount = 0;