diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index f3d40d0..83f480c 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -258,8 +258,6 @@
 
     friend class SkSurface_Raster;
 
-    void init(SkBitmap::Config config, int width, int height, bool isOpaque);
-
     // used to change the backend's pixels (and possibly config/rowbytes)
     // but cannot change the width/height, so there should be no change to
     // any clip information.
diff --git a/include/core/SkMallocPixelRef.h b/include/core/SkMallocPixelRef.h
index 5ef70d6..100a15d 100644
--- a/include/core/SkMallocPixelRef.h
+++ b/include/core/SkMallocPixelRef.h
@@ -17,52 +17,33 @@
 */
 class SkMallocPixelRef : public SkPixelRef {
 public:
-    /**
-     *  Return a new SkMallocPixelRef with the provided pixel storage, rowBytes,
-     *  and optional colortable. The caller is responsible for managing the
-     *  lifetime of the pixel storage buffer, as the pixelref will not try
-     *  to delete the storage.
-     *
-     *  This pixelref will ref() the specified colortable (if not NULL).
-     *
-     *  Returns NULL on failure.
+    /** Allocate the specified buffer for pixels. The memory is freed when the
+        last owner of this pixelref is gone. If addr is NULL, sk_malloc_throw()
+        is called to allocate it.
      */
-    static SkMallocPixelRef* NewDirect(const SkImageInfo&, void* addr,
-                                       size_t rowBytes, SkColorTable*);
-
-    /**
-     *  Return a new SkMallocPixelRef, automatically allocating storage for the
-     *  pixels. If rowBytes are 0, an optimal value will be chosen automatically.
-     *  If rowBytes is > 0, then it will be respected, or NULL will be returned
-     *  if rowBytes is invalid for the specified info.
-     *
-     *  This pixelref will ref() the specified colortable (if not NULL).
-     *
-     *  Returns NULL on failure.
-     */
-    static SkMallocPixelRef* NewAllocate(const SkImageInfo& info,
-                                         size_t rowBytes, SkColorTable*);
+    SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable, bool ownPixels = true);
+    virtual ~SkMallocPixelRef();
 
     void* getAddr() const { return fStorage; }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMallocPixelRef)
 
 protected:
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
-    virtual void onUnlockPixels() SK_OVERRIDE;
-    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
-    virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE;
+    // overrides from SkPixelRef
+    virtual void* onLockPixels(SkColorTable**);
+    virtual void onUnlockPixels();
 
     SkMallocPixelRef(SkFlattenableReadBuffer& buffer);
-    SkMallocPixelRef(const SkImageInfo&, void* addr, size_t rb, SkColorTable*,
-                     bool ownsPixels);
-    virtual ~SkMallocPixelRef();
+    virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+
+    // Returns the allocation size for the pixels
+    virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE { return fSize; }
 
 private:
-    void*               fStorage;
-    SkColorTable*       fCTable;
-    size_t              fRB;
-    const bool          fOwnPixels;
+    void*           fStorage;
+    size_t          fSize;
+    SkColorTable*   fCTable;
+    bool            fOwnPixels;
 
     typedef SkPixelRef INHERITED;
 };
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index cd6b3bc..bce343e 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -220,11 +220,10 @@
     // V14: Add flags word to PathRef serialization
     // V15: Remove A1 bitmpa config (and renumber remaining configs)
     // V16: Move SkPath's isOval flag to SkPathRef
-    // V17: Changes to PixelRef to store SkImageInfo
 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
     static const uint32_t PRIOR_PICTURE_VERSION = 15;  // TODO: remove when .skps regenerated
 #endif
-    static const uint32_t PICTURE_VERSION = 17;
+    static const uint32_t PICTURE_VERSION = 16;
 
     // fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
     // install their own SkPicturePlayback-derived players,SkPictureRecord-derived
diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h
index b096c3c..d4c3532 100644
--- a/include/core/SkPixelRef.h
+++ b/include/core/SkPixelRef.h
@@ -14,12 +14,9 @@
 #include "SkRefCnt.h"
 #include "SkString.h"
 #include "SkFlattenable.h"
-#include "SkImageInfo.h"
 #include "SkTDArray.h"
 
-//#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
-
-#define SK_SUPPORT_LEGACY_ONLOCKPIXELS
+#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
 
 #ifdef SK_DEBUG
     /**
@@ -70,48 +67,23 @@
     /** Return the pixel memory returned from lockPixels, or null if the
         lockCount is 0.
     */
-    void* pixels() const { return fRec.fPixels; }
+    void* pixels() const { return fPixels; }
 
     /** Return the current colorTable (if any) if pixels are locked, or null.
     */
-    SkColorTable* colorTable() const { return fRec.fColorTable; }
+    SkColorTable* colorTable() const { return fColorTable; }
 
     /**
-     *  To access the actual pixels of a pixelref, it must be "locked".
-     *  Calling lockPixels returns a LockRec struct (on success).
-     */
-    struct LockRec {
-        void*           fPixels;
-        SkColorTable*   fColorTable;
-        size_t          fRowBytes;
-        
-        void zero() { sk_bzero(this, sizeof(*this)); }
-
-        bool isZero() const {
-            return NULL == fPixels && NULL == fColorTable && 0 == fRowBytes;
-        }
-    };
-    
-    /**
      *  Returns true if the lockcount > 0
      */
     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();
-
-    /**
-     *  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);
-
+    /** Call to access the pixel memory, which is returned. Balance with a call
+        to unlockPixels().
+    */
+    void lockPixels();
     /** 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
@@ -268,27 +240,18 @@
     void addGenIDChangeListener(GenIDChangeListener* listener);
 
 protected:
-#ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS
-    virtual void* onLockPixels(SkColorTable**);
-    virtual bool onNewLockPixels(LockRec*);
-#else
+    /** Called when the lockCount goes from 0 to 1. The caller will have already
+        acquire a mutex for thread safety, so this method need not do that.
+    */
+    virtual void* onLockPixels(SkColorTable**) = 0;
+ 
     /**
-     *  On success, returns true and fills out the LockRec for the pixels. On
-     *  failure returns false and ignores the LockRec parameter.
+     *  Called when the lock count goes from 1 to 0. The caller will have
+     *  already acquire a mutex for thread safety, so this method need not do
+     *  that.
      *
-     *  The caller will have already acquired a mutex for thread safety, so this
-     *  method need not do that.
-     */
-    virtual bool onNewLockPixels(LockRec*) = 0;
-#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.
+     *  If the previous call to onLockPixels failed (i.e. returned NULL), then
+     *  the onUnlockPixels will NOT be called.
      */
     virtual void onUnlockPixels() = 0;
 
@@ -333,16 +296,16 @@
     // 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*);
+    void setPreLocked(void* pixels, SkColorTable* ctable);
 
 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;
-    
-    // LockRec is only valid if we're in a locked state (isLocked())
-    LockRec         fRec;
+
+    void*           fPixels;
+    SkColorTable*   fColorTable;    // we do not track ownership, subclass does
     int             fLockCount;
 
     mutable uint32_t fGenerationID;
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 15e44ab..c401a90 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -15,7 +15,6 @@
 
 class GrTexture;
 class GrRenderTarget;
-struct SkImageInfo;
 
 class GrSurface : public GrResource {
 public:
@@ -59,8 +58,6 @@
      */
     const GrTextureDesc& desc() const { return fDesc; }
 
-    void asImageInfo(SkImageInfo*) const;
-
     /**
      * @return the texture associated with the surface, may be NULL.
      */
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index db08548..5e5ca4b 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -50,7 +50,6 @@
  *  kUnknown_PixelConfig if the conversion cannot be done.
  */
 GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config);
-bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*);
 
 static inline GrColor SkColor2GrColor(SkColor c) {
     SkPMColor pm = SkPreMultiplyColor(c);
diff --git a/include/gpu/SkGrPixelRef.h b/include/gpu/SkGrPixelRef.h
index 4d33b9d..c29c27f 100644
--- a/include/gpu/SkGrPixelRef.h
+++ b/include/gpu/SkGrPixelRef.h
@@ -23,13 +23,14 @@
  */
 class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
 public:
-    SkROLockPixelsPixelRef(const SkImageInfo&);
+    SkROLockPixelsPixelRef();
     virtual ~SkROLockPixelsPixelRef();
 
 protected:
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
-    virtual void onUnlockPixels() SK_OVERRIDE;
-    virtual bool onLockPixelsAreWritable() const SK_OVERRIDE;   // return false;
+    // override from SkPixelRef
+    virtual void* onLockPixels(SkColorTable** ptr);
+    virtual void onUnlockPixels();
+    virtual bool onLockPixelsAreWritable() const;   // return false;
 
 private:
     SkBitmap    fBitmap;
@@ -46,6 +47,7 @@
      * cache and would like the pixel ref to unlock it in its destructor then transferCacheLock
      * should be set to true.
      */
+    SkGrPixelRef(GrSurface*, bool transferCacheLock = false);
     SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false);
     virtual ~SkGrPixelRef();
 
diff --git a/include/images/SkImageRef.h b/include/images/SkImageRef.h
index 36f95e6..0599a8d 100644
--- a/include/images/SkImageRef.h
+++ b/include/images/SkImageRef.h
@@ -34,7 +34,7 @@
         @param config The preferred config of the decoded bitmap.
         @param sampleSize Requested sampleSize for decoding. Defaults to 1.
     */
-    SkImageRef(const SkImageInfo&, SkStreamRewindable*, int sampleSize = 1,
+    SkImageRef(SkStreamRewindable*, SkBitmap::Config config, int sampleSize = 1,
                SkBaseMutex* mutex = NULL);
     virtual ~SkImageRef();
 
@@ -72,9 +72,9 @@
         When these are called, we will have already acquired the mutex!
      */
 
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
+    virtual void* onLockPixels(SkColorTable**);
     // override this in your subclass to clean up when we're unlocking pixels
-    virtual void onUnlockPixels() SK_OVERRIDE {}
+    virtual void onUnlockPixels() {}
 
     SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL);
     virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
@@ -89,6 +89,7 @@
 
     SkImageDecoderFactory*  fFactory;    // may be null
     SkStreamRewindable*     fStream;
+    SkBitmap::Config        fConfig;
     int                     fSampleSize;
     bool                    fDoDither;
     bool                    fErrorInDecoding;
diff --git a/include/images/SkImageRef_GlobalPool.h b/include/images/SkImageRef_GlobalPool.h
index caaf248..3adc0f6 100644
--- a/include/images/SkImageRef_GlobalPool.h
+++ b/include/images/SkImageRef_GlobalPool.h
@@ -15,7 +15,7 @@
 class SkImageRef_GlobalPool : public SkImageRef {
 public:
     // if pool is null, use the global pool
-    SkImageRef_GlobalPool(const SkImageInfo&, SkStreamRewindable*,
+    SkImageRef_GlobalPool(SkStreamRewindable*, SkBitmap::Config,
                           int sampleSize = 1);
     virtual ~SkImageRef_GlobalPool();
 
diff --git a/samplecode/SamplePicture.cpp b/samplecode/SamplePicture.cpp
index 2f7d691..66289af 100644
--- a/samplecode/SamplePicture.cpp
+++ b/samplecode/SamplePicture.cpp
@@ -40,9 +40,7 @@
 
         if (SkImageDecoder::DecodeStream(stream, &bm, SkBitmap::kNo_Config,
                                          SkImageDecoder::kDecodeBounds_Mode)) {
-            SkImageInfo info;
-            bm.asImageInfo(&info);
-            SkPixelRef* pr = new SkImageRef_GlobalPool(info, stream, 1);
+            SkPixelRef* pr = new SkImageRef_GlobalPool(stream, bm.config(), 1);
             bm.setPixelRef(pr)->unref();
         }
     }
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 7a7f690..25a6b1d 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -453,20 +453,10 @@
         return;
     }
 
-    SkImageInfo info;
-    if (!this->asImageInfo(&info)) {
-        this->setPixelRef(NULL, 0);
-        return;
-    }
+    Sk64 size = this->getSize64();
+    SkASSERT(!size.isNeg() && size.is32());
 
-    SkPixelRef* pr = SkMallocPixelRef::NewDirect(info, p, fRowBytes, ctable);
-    if (NULL == pr) {
-        this->setPixelRef(NULL, 0);
-        return;
-    }
-
-    this->setPixelRef(pr)->unref();
-
+    this->setPixelRef(new SkMallocPixelRef(p, size.get32(), ctable, false))->unref();
     // since we're already allocated, we lockPixels right away
     this->lockPixels();
     SkDEBUGCODE(this->validate();)
@@ -531,19 +521,17 @@
  */
 bool SkBitmap::HeapAllocator::allocPixelRef(SkBitmap* dst,
                                             SkColorTable* ctable) {
-    SkImageInfo info;
-    if (!dst->asImageInfo(&info)) {
-//        SkDebugf("unsupported config for info %d\n", dst->config());
-        return false;
-    }
-    
-    SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, dst->rowBytes(),
-                                                   ctable);
-    if (NULL == pr) {
+    Sk64 size = dst->getSize64();
+    if (size.isNeg() || !size.is32()) {
         return false;
     }
 
-    dst->setPixelRef(pr, 0)->unref();
+    void* addr = sk_malloc_flags(size.get32(), 0);  // returns NULL on failure
+    if (NULL == addr) {
+        return false;
+    }
+
+    dst->setPixelRef(new SkMallocPixelRef(addr, size.get32(), ctable))->unref();
     // since we're already allocated, we lockPixels right away
     dst->lockPixels();
     return true;
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 368c807..1668618 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -24,30 +24,31 @@
     , fBitmap(bitmap) {
 }
 
-void SkBitmapDevice::init(SkBitmap::Config config, int width, int height, bool isOpaque) {
+SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) {
     fBitmap.setConfig(config, width, height, 0, isOpaque ?
                       kOpaque_SkAlphaType : kPremul_SkAlphaType);
-    
-    if (SkBitmap::kNo_Config != config) {
-        if (!fBitmap.allocPixels()) {
-            // indicate failure by zeroing our bitmap
-            fBitmap.setConfig(config, 0, 0, 0, isOpaque ?
-                              kOpaque_SkAlphaType : kPremul_SkAlphaType);
-        } else if (!isOpaque) {
-            fBitmap.eraseColor(SK_ColorTRANSPARENT);
-        }
+    if (!fBitmap.allocPixels()) {
+        fBitmap.setConfig(config, 0, 0, 0, isOpaque ?
+                          kOpaque_SkAlphaType : kPremul_SkAlphaType);
     }
-}
-
-SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) {
-    this->init(config, width, height, isOpaque);
+    if (!isOpaque) {
+        fBitmap.eraseColor(SK_ColorTRANSPARENT);
+    }
 }
 
 SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
                                const SkDeviceProperties& deviceProperties)
-    : SkBaseDevice(deviceProperties)
-{
-    this->init(config, width, height, isOpaque);
+    : SkBaseDevice(deviceProperties) {
+
+    fBitmap.setConfig(config, width, height, 0, isOpaque ?
+                      kOpaque_SkAlphaType : kPremul_SkAlphaType);
+    if (!fBitmap.allocPixels()) {
+        fBitmap.setConfig(config, 0, 0, 0, isOpaque ?
+                          kOpaque_SkAlphaType : kPremul_SkAlphaType);
+    }
+    if (!isOpaque) {
+        fBitmap.eraseColor(SK_ColorTRANSPARENT);
+    }
 }
 
 SkBitmapDevice::~SkBitmapDevice() {
diff --git a/src/core/SkImageFilterUtils.cpp b/src/core/SkImageFilterUtils.cpp
index e535d93..8385fb4 100644
--- a/src/core/SkImageFilterUtils.cpp
+++ b/src/core/SkImageFilterUtils.cpp
@@ -15,14 +15,8 @@
 #include "SkGr.h"
 
 bool SkImageFilterUtils::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
-    SkImageInfo info;
-    info.fWidth = width;
-    info.fHeight = height;
-    info.fColorType = kPMColor_SkColorType;
-    info.fAlphaType = kPremul_SkAlphaType;
-
-    result->setConfig(info);
-    result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
+    result->setConfig(SkBitmap::kARGB_8888_Config, width, height);
+    result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (texture)))->unref();
     return true;
 }
 
@@ -42,12 +36,8 @@
     } else {
         if (filter->filterImage(proxy, src, ctm, result, offset)) {
             if (!result->getTexture()) {
-                SkImageInfo info;
-                if (!result->asImageInfo(&info)) {
-                    return false;
-                }
                 GrTexture* resultTex = GrLockAndRefCachedBitmapTexture(context, *result, NULL);
-                result->setPixelRef(new SkGrPixelRef(info, resultTex))->unref();
+                result->setPixelRef(new SkGrPixelRef(resultTex))->unref();
                 GrUnlockAndUnrefCachedBitmapTexture(resultTex);
             }
             return true;
diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp
index 613491a..f229e9d 100644
--- a/src/core/SkMallocPixelRef.cpp
+++ b/src/core/SkMallocPixelRef.cpp
@@ -1,105 +1,27 @@
+
 /*
  * Copyright 2011 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
-
 #include "SkMallocPixelRef.h"
 #include "SkBitmap.h"
 #include "SkFlattenableBuffers.h"
 
-static bool check_info(const SkImageInfo& info, SkColorTable* ctable) {
-    if (info.fWidth < 0 ||
-        info.fHeight < 0 ||
-        (unsigned)info.fColorType > (unsigned)kLastEnum_SkColorType ||
-        (unsigned)info.fAlphaType > (unsigned)kLastEnum_SkAlphaType)
-    {
-        return false;
+SkMallocPixelRef::SkMallocPixelRef(void* storage, size_t size,
+                                   SkColorTable* ctable, bool ownPixels) {
+    if (NULL == storage) {
+        SkASSERT(ownPixels);
+        storage = sk_malloc_throw(size);
     }
-    
-    // these seem like good checks, but currently we have (at least) tests
-    // that expect the pixelref to succeed even when there is a mismatch
-    // with colortables. fix?
-#if 0
-    if (kIndex8_SkColorType == info.fColorType && NULL == ctable) {
-        return false;
-    }
-    if (kIndex8_SkColorType != info.fColorType && NULL != ctable) {
-        return false;
-    }
-#endif
-    return true;
-}
-
-SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info,
-                                              void* addr,
-                                              size_t rowBytes,
-                                              SkColorTable* ctable) {
-    if (!check_info(info, ctable)) {
-        return NULL;
-    }
-    return SkNEW_ARGS(SkMallocPixelRef, (info, addr, rowBytes, ctable, false));
-}
-
-SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
-                                                size_t requestedRowBytes,
-                                                SkColorTable* ctable) {
-    if (!check_info(info, ctable)) {
-        return NULL;
-    }
-
-    int32_t minRB = info.minRowBytes();
-    if (minRB < 0) {
-        return NULL;    // allocation will be too large
-    }
-    if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) {
-        return NULL;    // cannot meet requested rowbytes
-    }
-
-    int32_t rowBytes;
-    if (requestedRowBytes) {
-        rowBytes = requestedRowBytes;
-    } else {
-        rowBytes = minRB;
-    }
-
-    Sk64 bigSize;
-    bigSize.setMul(info.fHeight, rowBytes);
-    if (!bigSize.is32()) {
-        return NULL;
-    }
-
-    size_t size = bigSize.get32();
-    void* addr = sk_malloc_flags(size, 0);
-    if (NULL == addr) {
-        return NULL;
-    }
-
-    return SkNEW_ARGS(SkMallocPixelRef, (info, addr, rowBytes, ctable, true));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkMallocPixelRef::SkMallocPixelRef(const SkImageInfo& info, void* storage,
-                                   size_t rowBytes, SkColorTable* ctable,
-                                   bool ownsPixels)
-    : SkPixelRef(info)
-    , fOwnPixels(ownsPixels)
-{
-    SkASSERT(check_info(info, ctable));
-    SkASSERT(rowBytes >= info.minRowBytes());
-
-    if (kIndex_8_SkColorType != info.fColorType) {
-        ctable = NULL;
-    }
-
     fStorage = storage;
+    fSize = size;
     fCTable = ctable;
-    fRB = rowBytes;
     SkSafeRef(ctable);
-    
-    this->setPreLocked(fStorage, fRB, fCTable);
+    fOwnPixels = ownPixels;
+
+    this->setPreLocked(fStorage, fCTable);
 }
 
 SkMallocPixelRef::~SkMallocPixelRef() {
@@ -109,30 +31,19 @@
     }
 }
 
-bool SkMallocPixelRef::onNewLockPixels(LockRec* rec) {
-    rec->fPixels = fStorage;
-    rec->fRowBytes = fRB;
-    rec->fColorTable = fCTable;
-    return true;
+void* SkMallocPixelRef::onLockPixels(SkColorTable** ct) {
+    *ct = fCTable;
+    return fStorage;
 }
 
 void SkMallocPixelRef::onUnlockPixels() {
     // nothing to do
 }
 
-size_t SkMallocPixelRef::getAllocatedSizeInBytes() const {
-    return this->info().getSafeSize(fRB);
-}
-
 void SkMallocPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
 
-    buffer.write32(fRB);
-
-    // TODO: replace this bulk write with a chunky one that can trim off any
-    // trailing bytes on each scanline (in case rowbytes > width*size)
-    size_t size = this->info().getSafeSize(fRB);
-    buffer.writeByteArray(fStorage, size);
+    buffer.writeByteArray(fStorage, fSize);
     buffer.writeBool(fCTable != NULL);
     if (fCTable) {
         fCTable->writeToBuffer(buffer);
@@ -140,18 +51,16 @@
 }
 
 SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer)
-    : INHERITED(buffer, NULL)
-    , fOwnPixels(true)
-{
-    fRB = buffer.read32();
-    size_t size = this->info().getSafeSize(fRB);
-    fStorage = sk_malloc_throw(size);
-    buffer.readByteArray(fStorage, size);
+        : INHERITED(buffer, NULL) {
+    fSize = buffer.getArrayCount();
+    fStorage = sk_malloc_throw(fSize);
+    buffer.readByteArray(fStorage, fSize);
     if (buffer.readBool()) {
         fCTable = SkNEW_ARGS(SkColorTable, (buffer));
     } else {
         fCTable = NULL;
     }
+    fOwnPixels = true;
 
-    this->setPreLocked(fStorage, fRB, fCTable);
+    this->setPreLocked(fStorage, fCTable);
 }
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index adfed41..f062f13 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -349,14 +349,10 @@
     if (!result) {
         return false;
     }
-    SkAutoUnref aur(dst);
 
-    SkImageInfo info;
     resultBM->setConfig(srcBM.config(), dst->width(), dst->height());
-    if (resultBM->asImageInfo(&info)) {
-        return false;
-    }
-    resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, dst)))->unref();
+    resultBM->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (dst)))->unref();
+    dst->unref();
     return true;
 }
 
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 5d394d5..da88ca5 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -82,32 +82,48 @@
 // just need a > 0 value, so pick a funny one to aid in debugging
 #define SKPIXELREF_PRELOCKED_LOCKCOUNT     123456789
 
-SkPixelRef::SkPixelRef(const SkImageInfo& info) {
-    this->setMutex(NULL);
+SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) {
+    this->setMutex(mutex);
     fInfo = info;
-    fRec.zero();
+    fPixels = NULL;
+    fColorTable = NULL; // we do not track ownership of this
     fLockCount = 0;
     this->needsNewGenID();
     fIsImmutable = false;
     fPreLocked = false;
 }
 
-SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) {
-    this->setMutex(mutex);
+SkPixelRef::SkPixelRef(const SkImageInfo& info) {
+    this->setMutex(NULL);
     fInfo = info;
-    fRec.zero();
+    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);
+    // 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;
+}
+#endif
+
 SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
         : INHERITED(buffer) {
     this->setMutex(mutex);
-
-    fInfo.unflatten(buffer);
-    fRec.zero();
+    fPixels = NULL;
+    fColorTable = NULL; // we do not track ownership of this
     fLockCount = 0;
     fIsImmutable = buffer.readBool();
     fGenerationID = buffer.readUInt();
@@ -131,13 +147,12 @@
     that.fUniqueGenerationID = false;
 }
 
-void SkPixelRef::setPreLocked(void* pixels, size_t rowBytes, SkColorTable* ctable) {
+void SkPixelRef::setPreLocked(void* pixels, SkColorTable* ctable) {
 #ifndef SK_IGNORE_PIXELREF_SETPRELOCKED
     // only call me in your constructor, otherwise fLockCount tracking can get
     // out of sync.
-    fRec.fPixels = pixels;
-    fRec.fColorTable = ctable;
-    fRec.fRowBytes = rowBytes;
+    fPixels = pixels;
+    fColorTable = ctable;
     fLockCount = SKPIXELREF_PRELOCKED_LOCKCOUNT;
     fPreLocked = true;
 #endif
@@ -145,8 +160,6 @@
 
 void SkPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
-
-    fInfo.flatten(buffer);
     buffer.writeBool(fIsImmutable);
     // We write the gen ID into the picture for within-process recording. This
     // is safe since the same genID will never refer to two different sets of
@@ -161,30 +174,20 @@
     }
 }
 
-bool SkPixelRef::lockPixels(LockRec* rec) {
+void SkPixelRef::lockPixels() {
     SkASSERT(!fPreLocked || SKPIXELREF_PRELOCKED_LOCKCOUNT == fLockCount);
-    
+
     if (!fPreLocked) {
         SkAutoMutexAcquire  ac(*fMutex);
-        
-        if (1 == ++fLockCount) {
-            SkASSERT(fRec.isZero());
 
-            LockRec rec;
-            if (!this->onNewLockPixels(&rec)) {
-                return false;
+        if (1 == ++fLockCount) {
+            fPixels = this->onLockPixels(&fColorTable);
+            // If onLockPixels failed, it will return NULL
+            if (NULL == fPixels) {
+                fColorTable = NULL;
             }
-            SkASSERT(!rec.isZero());    // else why did onNewLock return true?
-            fRec = rec;
         }
     }
-    *rec = fRec;
-    return true;
-}
-
-bool SkPixelRef::lockPixels() {
-    LockRec rec;
-    return this->lockPixels(&rec);
 }
 
 void SkPixelRef::unlockPixels() {
@@ -196,11 +199,12 @@
         SkASSERT(fLockCount > 0);
         if (0 == --fLockCount) {
             // don't call onUnlockPixels unless onLockPixels succeeded
-            if (fRec.fPixels) {
+            if (fPixels) {
                 this->onUnlockPixels();
-                fRec.zero();
+                fPixels = NULL;
+                fColorTable = NULL;
             } else {
-                SkASSERT(fRec.isZero());
+                SkASSERT(NULL == fColorTable);
             }
         }
     }
@@ -282,29 +286,6 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-#ifdef SK_SUPPORT_LEGACY_ONLOCKPIXELS
-
-void* SkPixelRef::onLockPixels(SkColorTable** ctable) {
-    return NULL;
-}
-
-bool SkPixelRef::onNewLockPixels(LockRec* rec) {
-    SkColorTable* ctable;
-    void* pixels = this->onLockPixels(&ctable);
-    if (!pixels) {
-        return false;
-    }
-
-    rec->fPixels = pixels;
-    rec->fColorTable = ctable;
-    rec->fRowBytes = 0; // callers don't currently need this (thank goodness)
-    return true;
-}
-
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-
 #ifdef SK_BUILD_FOR_ANDROID
 void SkPixelRef::globalRef(void* data) {
     this->ref();
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 5d200d1..2776199 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -513,14 +513,13 @@
 
 const SkPMColor* SkGradientShaderBase::getCache32() const {
     if (fCache32 == NULL) {
-        SkImageInfo info;
-        info.fWidth = kCache32Count;
-        info.fHeight = 4;   // for our 4 dither rows
-        info.fAlphaType = kPremul_SkAlphaType;
-        info.fColorType = kPMColor_SkColorType;
+        // double the count for dither entries
+        const int entryCount = kCache32Count * 4;
+        const size_t allocSize = sizeof(SkPMColor) * entryCount;
 
         if (NULL == fCache32PixelRef) {
-            fCache32PixelRef = SkMallocPixelRef::NewAllocate(info, 0, NULL);
+            fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
+                                          (NULL, allocSize, NULL));
         }
         fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
         if (fColorCount == 2) {
@@ -542,7 +541,8 @@
         }
 
         if (fMapper) {
-            SkMallocPixelRef* newPR = SkMallocPixelRef::NewAllocate(info, 0, NULL);
+            SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
+                                                 (NULL, allocSize, NULL));
             SkPMColor* linear = fCache32;           // just computed linear data
             SkPMColor* mapped = (SkPMColor*)newPR->getAddr();    // storage for mapped data
             SkUnitMapper* map = fMapper;
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 1fcc4ff..fed95f2 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -8,19 +8,9 @@
 #include "GrSurface.h"
 
 #include "SkBitmap.h"
-#include "SkGr.h"
 #include "SkImageEncoder.h"
 #include <stdio.h>
 
-void GrSurface::asImageInfo(SkImageInfo* info) const {
-    if (!GrPixelConfig2ColorType(this->config(), &info->fColorType)) {
-        sk_throw();
-    }
-    info->fWidth = this->width();
-    info->fHeight = this->height();
-    info->fAlphaType = kPremul_SkAlphaType;
-}
-
 bool GrSurface::savePixels(const char* filename) {
     SkBitmap bm;
     bm.setConfig(SkBitmap::kARGB_8888_Config, this->width(), this->height());
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index a413d04..ce02f2c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -214,10 +214,7 @@
     if (NULL == surface) {
         surface = fRenderTarget;
     }
-
-    SkImageInfo info;
-    surface->asImageInfo(&info);
-    SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, surface, cached));
+    SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (surface, cached));
 
     this->setPixelRef(pr, 0)->unref();
 }
@@ -227,8 +224,8 @@
                          int width,
                          int height,
                          int sampleCount)
-    : SkBitmapDevice(make_bitmap(config, width, height, false /*isOpaque*/))
-{
+    : SkBitmapDevice(make_bitmap(config, width, height, false /*isOpaque*/)) {
+
     fDrawProcs = NULL;
 
     fContext = context;
@@ -248,14 +245,6 @@
     desc.fConfig = SkBitmapConfig2GrPixelConfig(config);
     desc.fSampleCnt = sampleCount;
 
-    SkImageInfo info;
-    if (!GrPixelConfig2ColorType(desc.fConfig, &info.fColorType)) {
-        sk_throw();
-    }
-    info.fWidth = width;
-    info.fHeight = height;
-    info.fAlphaType = kPremul_SkAlphaType;
-        
     SkAutoTUnref<GrTexture> texture(fContext->createUncachedTexture(desc, NULL, 0));
 
     if (NULL != texture) {
@@ -265,7 +254,7 @@
         SkASSERT(NULL != fRenderTarget);
 
         // wrap the bitmap with a pixelref to expose our texture
-        SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, texture));
+        SkGrPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (texture));
         this->setPixelRef(pr, 0)->unref();
     } else {
         GrPrintf("--- failed to create gpu-offscreen [%d %d]\n",
@@ -851,12 +840,11 @@
 }
 
 SkBitmap wrap_texture(GrTexture* texture) {
-    SkImageInfo info;
-    texture->asImageInfo(&info);
-
     SkBitmap result;
-    result.setConfig(info);
-    result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
+    bool dummy;
+    SkBitmap::Config config = grConfig2skConfig(texture->config(), &dummy);
+    result.setConfig(config, texture->width(), texture->height());
+    result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (texture)))->unref();
     return result;
 }
 
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index a3f0eef..c7ae0c8 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -258,33 +258,3 @@
             return kUnknown_GrPixelConfig;
     }
 }
-
-bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) {
-    SkColorType ct;
-    switch (config) {
-        case kAlpha_8_GrPixelConfig:
-            ct = kAlpha_8_SkColorType;
-            break;
-        case kIndex_8_GrPixelConfig:
-            ct = kIndex_8_SkColorType;
-            break;
-        case kRGB_565_GrPixelConfig:
-            ct = kRGB_565_SkColorType;
-            break;
-        case kRGBA_4444_GrPixelConfig:
-            ct = kARGB_4444_SkColorType;
-            break;
-        case kRGBA_8888_GrPixelConfig:
-            ct = kRGBA_8888_SkColorType;
-            break;
-        case kBGRA_8888_GrPixelConfig:
-            ct = kBGRA_8888_SkColorType;
-            break;
-        default:
-            return false;
-    }
-    if (ctOut) {
-        *ctOut = ct;
-    }
-    return true;
-}
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 74b1a4f..0129426 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -18,29 +18,24 @@
 // to avoid deadlock with the default one provided by SkPixelRef.
 SK_DECLARE_STATIC_MUTEX(gROLockPixelsPixelRefMutex);
 
-SkROLockPixelsPixelRef::SkROLockPixelsPixelRef(const SkImageInfo& info)
-    : INHERITED(info, &gROLockPixelsPixelRefMutex) {
+SkROLockPixelsPixelRef::SkROLockPixelsPixelRef() : INHERITED(&gROLockPixelsPixelRefMutex) {
 }
 
 SkROLockPixelsPixelRef::~SkROLockPixelsPixelRef() {
 }
 
-bool SkROLockPixelsPixelRef::onNewLockPixels(LockRec* rec) {
+void* SkROLockPixelsPixelRef::onLockPixels(SkColorTable** ctable) {
+    if (ctable) {
+        *ctable = NULL;
+    }
     fBitmap.reset();
 //    SkDebugf("---------- calling readpixels in support of lockpixels\n");
     if (!this->onReadPixels(&fBitmap, NULL)) {
         SkDebugf("SkROLockPixelsPixelRef::onLockPixels failed!\n");
-        return false;
+        return NULL;
     }
     fBitmap.lockPixels();
-    if (NULL == fBitmap.getPixels()) {
-        return false;
-    }
-
-    rec->fPixels = fBitmap.getPixels();
-    rec->fColorTable = NULL;
-    rec->fRowBytes = fBitmap.rowBytes();
-    return true;
+    return fBitmap.getPixels();
 }
 
 void SkROLockPixelsPixelRef::onUnlockPixels() {
@@ -81,14 +76,6 @@
     desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
     desc.fConfig = SkBitmapConfig2GrPixelConfig(dstConfig);
 
-    SkImageInfo info;
-    if (!GrPixelConfig2ColorType(desc.fConfig, &info.fColorType)) {
-        return NULL;
-    }
-    info.fWidth = desc.fWidth;
-    info.fHeight = desc.fHeight;
-    info.fAlphaType = kPremul_SkAlphaType;
-    
     GrTexture* dst = context->createUncachedTexture(desc, NULL, 0);
     if (NULL == dst) {
         return NULL;
@@ -106,17 +93,31 @@
     dst->releaseRenderTarget();
 #endif
 
-    SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst));
+    SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (dst));
     SkSafeUnref(dst);
     return pixelRef;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface,
-                           bool transferCacheLock)
-    : INHERITED(info)
-{
+SkGrPixelRef::SkGrPixelRef(GrSurface* surface, bool transferCacheLock) {
+    // TODO: figure out if this is responsible for Chrome canvas errors
+#if 0
+    // The GrTexture has a ref to the GrRenderTarget but not vice versa.
+    // If the GrTexture exists take a ref to that (rather than the render
+    // target)
+    fSurface = surface->asTexture();
+#else
+    fSurface = NULL;
+#endif
+    if (NULL == fSurface) {
+        fSurface = surface;
+    }
+    fUnlock = transferCacheLock;
+    SkSafeRef(surface);
+}
+
+SkGrPixelRef::SkGrPixelRef(const SkImageInfo&, GrSurface* surface, bool transferCacheLock) {
     // TODO: figure out if this is responsible for Chrome canvas errors
 #if 0
     // The GrTexture has a ref to the GrRenderTarget but not vice versa.
diff --git a/src/image/SkDataPixelRef.cpp b/src/image/SkDataPixelRef.cpp
index 875f933..7897bf9 100644
--- a/src/image/SkDataPixelRef.cpp
+++ b/src/image/SkDataPixelRef.cpp
@@ -9,25 +9,18 @@
 #include "SkData.h"
 #include "SkFlattenableBuffers.h"
 
-SkDataPixelRef::SkDataPixelRef(const SkImageInfo& info,
-                               SkData* data, size_t rowBytes)
-    : INHERITED(info)
-    , fData(data)
-    , fRB(rowBytes) 
-{
+SkDataPixelRef::SkDataPixelRef(SkData* data) : fData(data) {
     fData->ref();
-    this->setPreLocked(const_cast<void*>(fData->data()), rowBytes, NULL);
+    this->setPreLocked(const_cast<void*>(fData->data()), NULL);
 }
 
 SkDataPixelRef::~SkDataPixelRef() {
     fData->unref();
 }
 
-bool SkDataPixelRef::onNewLockPixels(LockRec* rec) {
-    rec->fPixels = const_cast<void*>(fData->data());
-    rec->fColorTable = NULL;
-    rec->fRowBytes = fRB;
-    return true;
+void* SkDataPixelRef::onLockPixels(SkColorTable** ct) {
+    *ct = NULL;
+    return const_cast<void*>(fData->data());
 }
 
 void SkDataPixelRef::onUnlockPixels() {
@@ -40,15 +33,11 @@
 
 void SkDataPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
-    
     buffer.writeDataAsByteArray(fData);
-    buffer.write32(fRB);
 }
 
 SkDataPixelRef::SkDataPixelRef(SkFlattenableReadBuffer& buffer)
-    : INHERITED(buffer, NULL)
-{
+        : INHERITED(buffer, NULL) {
     fData = buffer.readByteArrayAsData();
-    fRB = buffer.read32();
-    this->setPreLocked(const_cast<void*>(fData->data()), fRB, NULL);
+    this->setPreLocked(const_cast<void*>(fData->data()), NULL);
 }
diff --git a/src/image/SkDataPixelRef.h b/src/image/SkDataPixelRef.h
index c2e52cd..50c8857 100644
--- a/src/image/SkDataPixelRef.h
+++ b/src/image/SkDataPixelRef.h
@@ -14,13 +14,13 @@
 
 class SkDataPixelRef : public SkPixelRef {
 public:
-            SkDataPixelRef(const SkImageInfo&, SkData* data, size_t rowBytes);
+            SkDataPixelRef(SkData* data);
     virtual ~SkDataPixelRef();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDataPixelRef)
 
 protected:
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
+    virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
     virtual void onUnlockPixels() SK_OVERRIDE;
     virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE;
 
@@ -28,8 +28,7 @@
     virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
 
 private:
-    SkData*     fData;
-    size_t      fRB;
+    SkData* fData;
 
     typedef SkPixelRef INHERITED;
 };
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 93de5ea..a872ae3 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -84,8 +84,10 @@
 
 SkImage_Raster::SkImage_Raster(const Info& info, SkData* data, size_t rowBytes)
         : INHERITED(info.fWidth, info.fHeight) {
-    fBitmap.setConfig(info, rowBytes);
-    fBitmap.setPixelRef(SkNEW_ARGS(SkDataPixelRef, (info, data, rowBytes)))->unref();
+    SkBitmap::Config config = SkImageInfoToBitmapConfig(info);
+
+    fBitmap.setConfig(config, info.fWidth, info.fHeight, rowBytes, info.fAlphaType);
+    fBitmap.setPixelRef(SkNEW_ARGS(SkDataPixelRef, (data)))->unref();
     fBitmap.setImmutable();
 }
 
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 61ade6f..27db504 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -155,9 +155,19 @@
         return NULL;
     }
 
-    SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL));
-    if (NULL == pr.get()) {
+    static const size_t kMaxTotalSize = SK_MaxS32;
+    size_t rowBytes = SkImageMinRowBytes(info);
+    uint64_t size64 = (uint64_t)info.fHeight * rowBytes;
+    if (size64 > kMaxTotalSize) {
         return NULL;
     }
-    return SkNEW_ARGS(SkSurface_Raster, (info, pr, info.minRowBytes()));
+
+    size_t size = (size_t)size64;
+    void* pixels = sk_malloc_throw(size);
+    if (NULL == pixels) {
+        return NULL;
+    }
+
+    SkAutoTUnref<SkPixelRef> pr(SkNEW_ARGS(SkMallocPixelRef, (pixels, size, NULL, true)));
+    return SkNEW_ARGS(SkSurface_Raster, (info, pr, rowBytes));
 }
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index 99782c4..1a8284b 100644
--- a/src/images/SkImageRef.cpp
+++ b/src/images/SkImageRef.cpp
@@ -15,14 +15,16 @@
 
 //#define DUMP_IMAGEREF_LIFECYCLE
 
+
 ///////////////////////////////////////////////////////////////////////////////
 
-SkImageRef::SkImageRef(const SkImageInfo& info, SkStreamRewindable* stream,
+SkImageRef::SkImageRef(SkStreamRewindable* stream, SkBitmap::Config config,
                        int sampleSize, SkBaseMutex* mutex)
-        : INHERITED(info, mutex), fErrorInDecoding(false) {
+        : SkPixelRef(mutex), fErrorInDecoding(false) {
     SkASSERT(stream);
     stream->ref();
     fStream = stream;
+    fConfig = config;
     fSampleSize = sampleSize;
     fDoDither = true;
     fPrev = fNext = NULL;
@@ -38,7 +40,7 @@
 
 #ifdef DUMP_IMAGEREF_LIFECYCLE
     SkDebugf("delete ImageRef %p [%d] data=%d\n",
-              this, this->info().fColorType, (int)fStream->getLength());
+              this, fConfig, (int)fStream->getLength());
 #endif
 
     fStream->unref();
@@ -90,6 +92,14 @@
         return false;
     }
 
+    /*  As soon as we really know our config, we record it, so that on
+        subsequent calls to the codec, we are sure we will always get the same
+        result.
+    */
+    if (SkBitmap::kNo_Config != fBitmap.config()) {
+        fConfig = fBitmap.config();
+    }
+
     if (NULL != fBitmap.getPixels() ||
             (SkBitmap::kNo_Config != fBitmap.config() &&
              SkImageDecoder::kDecodeBounds_Mode == mode)) {
@@ -115,7 +125,7 @@
 
         codec->setSampleSize(fSampleSize);
         codec->setDitherImage(fDoDither);
-        if (this->onDecode(codec, fStream, &fBitmap, fBitmap.config(), mode)) {
+        if (this->onDecode(codec, fStream, &fBitmap, fConfig, mode)) {
             return true;
         }
     }
@@ -133,18 +143,15 @@
     return false;
 }
 
-bool SkImageRef::onNewLockPixels(LockRec* rec) {
+void* SkImageRef::onLockPixels(SkColorTable** ct) {
     if (NULL == fBitmap.getPixels()) {
         (void)this->prepareBitmap(SkImageDecoder::kDecodePixels_Mode);
     }
 
-    if (NULL == fBitmap.getPixels()) {
-        return false;
+    if (ct) {
+        *ct = fBitmap.getColorTable();
     }
-    rec->fPixels = fBitmap.getPixels();
-    rec->fColorTable = NULL;
-    rec->fRowBytes = fBitmap.rowBytes();
-    return true;
+    return fBitmap.getPixels();
 }
 
 size_t SkImageRef::ramUsed() const {
@@ -163,6 +170,7 @@
 
 SkImageRef::SkImageRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
         : INHERITED(buffer, mutex), fErrorInDecoding(false) {
+    fConfig = (SkBitmap::Config)buffer.readUInt();
     fSampleSize = buffer.readInt();
     fDoDither = buffer.readBool();
 
@@ -177,6 +185,7 @@
 void SkImageRef::flatten(SkFlattenableWriteBuffer& buffer) const {
     this->INHERITED::flatten(buffer);
 
+    buffer.writeUInt(fConfig);
     buffer.writeInt(fSampleSize);
     buffer.writeBool(fDoDither);
     // FIXME: Consider moving this logic should go into writeStream itself.
diff --git a/src/images/SkImageRef_GlobalPool.cpp b/src/images/SkImageRef_GlobalPool.cpp
index f91ceba..352dd42 100644
--- a/src/images/SkImageRef_GlobalPool.cpp
+++ b/src/images/SkImageRef_GlobalPool.cpp
@@ -24,10 +24,10 @@
     return gPool;
 }
 
-SkImageRef_GlobalPool::SkImageRef_GlobalPool(const SkImageInfo& info,
-                                             SkStreamRewindable* stream,
+SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkStreamRewindable* stream,
+                                             SkBitmap::Config config,
                                              int sampleSize)
-        : SkImageRef(info, stream, sampleSize, &gGlobalPoolMutex) {
+        : SkImageRef(stream, config, sampleSize, &gGlobalPoolMutex) {
     SkASSERT(&gGlobalPoolMutex == this->mutex());
     SkAutoMutexAcquire ac(gGlobalPoolMutex);
     GetGlobalPool()->addToHead(this);
diff --git a/src/images/SkImageRef_ashmem.cpp b/src/images/SkImageRef_ashmem.cpp
index eaa875d..9933ca9 100644
--- a/src/images/SkImageRef_ashmem.cpp
+++ b/src/images/SkImageRef_ashmem.cpp
@@ -31,10 +31,10 @@
     return newsize;
 }
 
-SkImageRef_ashmem::SkImageRef_ashmem(const SkImageInfo& info,
-                                     SkStreamRewindable* stream,
-                                     int sampleSize)
-        : SkImageRef(info, stream, sampleSize) {
+SkImageRef_ashmem::SkImageRef_ashmem(SkStreamRewindable* stream,
+                                             SkBitmap::Config config,
+                                             int sampleSize)
+        : SkImageRef(stream, config, sampleSize) {
 
     fRec.fFD = -1;
     fRec.fAddr = NULL;
diff --git a/src/images/SkImageRef_ashmem.h b/src/images/SkImageRef_ashmem.h
index a2652fb..efee5e7 100644
--- a/src/images/SkImageRef_ashmem.h
+++ b/src/images/SkImageRef_ashmem.h
@@ -19,7 +19,7 @@
 
 class SkImageRef_ashmem : public SkImageRef {
 public:
-    SkImageRef_ashmem(const SkImageInfo&, SkStreamRewindable*, int sampleSize = 1);
+    SkImageRef_ashmem(SkStreamRewindable*, SkBitmap::Config, int sampleSize = 1);
     virtual ~SkImageRef_ashmem();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)
diff --git a/src/lazy/SkCachingPixelRef.cpp b/src/lazy/SkCachingPixelRef.cpp
index 2419e37..b7eaf57 100644
--- a/src/lazy/SkCachingPixelRef.cpp
+++ b/src/lazy/SkCachingPixelRef.cpp
@@ -8,6 +8,7 @@
 #include "SkCachingPixelRef.h"
 #include "SkScaledImageCache.h"
 
+
 bool SkCachingPixelRef::Install(SkImageGenerator* generator,
                                 SkBitmap* dst) {
     SkImageInfo info;
@@ -30,10 +31,10 @@
 SkCachingPixelRef::SkCachingPixelRef(SkImageGenerator* generator,
                                      const SkImageInfo& info,
                                      size_t rowBytes)
-    : INHERITED(info)
-    , fImageGenerator(generator)
+    : fImageGenerator(generator)
     , fErrorInDecoding(false)
     , fScaledCacheId(NULL)
+    , fInfo(info)
     , fRowBytes(rowBytes) {
     SkASSERT(fImageGenerator != NULL);
 }
@@ -43,32 +44,31 @@
     // Assert always unlock before unref.
 }
 
-bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
+void* SkCachingPixelRef::onLockPixels(SkColorTable** colorTable) {
+    (void)colorTable;
     if (fErrorInDecoding) {
-        return false;  // don't try again.
+        return NULL;  // don't try again.
     }
-    
-    const SkImageInfo& info = this->info();
     SkBitmap bitmap;
     SkASSERT(NULL == fScaledCacheId);
     fScaledCacheId = SkScaledImageCache::FindAndLock(this->getGenerationID(),
-                                                     info.fWidth,
-                                                     info.fHeight,
+                                                     fInfo.fWidth,
+                                                     fInfo.fHeight,
                                                      &bitmap);
     if (NULL == fScaledCacheId) {
         // Cache has been purged, must re-decode.
-        if ((!bitmap.setConfig(info, fRowBytes)) || !bitmap.allocPixels()) {
+        if ((!bitmap.setConfig(fInfo, fRowBytes)) || !bitmap.allocPixels()) {
             fErrorInDecoding = true;
-            return false;
+            return NULL;
         }
         SkAutoLockPixels autoLockPixels(bitmap);
-        if (!fImageGenerator->getPixels(info, bitmap.getPixels(), fRowBytes)) {
+        if (!fImageGenerator->getPixels(fInfo, bitmap.getPixels(), fRowBytes)) {
             fErrorInDecoding = true;
-            return false;
+            return NULL;
         }
         fScaledCacheId = SkScaledImageCache::AddAndLock(this->getGenerationID(),
-                                                        info.fWidth,
-                                                        info.fHeight,
+                                                        fInfo.fWidth,
+                                                        fInfo.fHeight,
                                                         bitmap);
         SkASSERT(fScaledCacheId != NULL);
     }
@@ -78,7 +78,6 @@
     SkAutoLockPixels autoLockPixels(bitmap);
     void* pixels = bitmap.getPixels();
     SkASSERT(pixels != NULL);
-    
     // At this point, the autoLockPixels will unlockPixels()
     // to remove bitmap's lock on the pixels.  We will then
     // destroy bitmap.  The *only* guarantee that this pointer
@@ -87,10 +86,7 @@
     // bitmap (SkScaledImageCache::Rec.fBitmap) that holds a
     // reference to the concrete PixelRef while this record is
     // locked.
-    rec->fPixels = pixels;
-    rec->fColorTable = NULL;
-    rec->fRowBytes = bitmap.rowBytes();
-    return true;
+    return pixels;
 }
 
 void SkCachingPixelRef::onUnlockPixels() {
diff --git a/src/lazy/SkCachingPixelRef.h b/src/lazy/SkCachingPixelRef.h
index 75710d8..4a0387d 100644
--- a/src/lazy/SkCachingPixelRef.h
+++ b/src/lazy/SkCachingPixelRef.h
@@ -40,7 +40,7 @@
 
 protected:
     virtual ~SkCachingPixelRef();
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
+    virtual void* onLockPixels(SkColorTable** colorTable) SK_OVERRIDE;
     virtual void onUnlockPixels() SK_OVERRIDE;
     virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
 
@@ -58,12 +58,12 @@
     SkImageGenerator* const fImageGenerator;
     bool                    fErrorInDecoding;
     void*                   fScaledCacheId;
+    const SkImageInfo       fInfo;
     const size_t            fRowBytes;
 
     SkCachingPixelRef(SkImageGenerator* imageGenerator,
                       const SkImageInfo& info,
                       size_t rowBytes);
-
     typedef SkPixelRef INHERITED;
 };
 
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 77ac825..f551436 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -11,15 +11,17 @@
 
 SkDiscardablePixelRef::SkDiscardablePixelRef(SkImageGenerator* generator,
                                              const SkImageInfo& info,
+                                             size_t size,
                                              size_t rowBytes,
                                              SkDiscardableMemory::Factory* fact)
-    : INHERITED(info)
-    , fGenerator(generator)
+    : fGenerator(generator)
     , fDMFactory(fact)
+    , fInfo(info)
+    , fSize(size)
     , fRowBytes(rowBytes)
-    , fDiscardableMemory(NULL)
-{
+    , fDiscardableMemory(NULL) {
     SkASSERT(fGenerator != NULL);
+    SkASSERT(fSize > 0);
     SkASSERT(fRowBytes > 0);
     // The SkImageGenerator contract requires fGenerator to always
     // decode the same image on each call to getPixels().
@@ -36,42 +38,31 @@
     SkDELETE(fGenerator);
 }
 
-bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
+void* SkDiscardablePixelRef::onLockPixels(SkColorTable**) {
     if (fDiscardableMemory != NULL) {
         if (fDiscardableMemory->lock()) {
-            rec->fPixels = fDiscardableMemory->data();
-            rec->fColorTable = NULL;
-            rec->fRowBytes = fRowBytes;
-            return true;
+            return fDiscardableMemory->data();
         }
         SkDELETE(fDiscardableMemory);
         fDiscardableMemory = NULL;
     }
-    
-    const size_t size = this->info().getSafeSize(fRowBytes);
     if (fDMFactory != NULL) {
-        fDiscardableMemory = fDMFactory->create(size);
+        fDiscardableMemory = fDMFactory->create(fSize);
     } else {
-        fDiscardableMemory = SkDiscardableMemory::Create(size);
+        fDiscardableMemory = SkDiscardableMemory::Create(fSize);
     }
     if (NULL == fDiscardableMemory) {
-        return false;  // Memory allocation failed.
+        return NULL;  // Memory allocation failed.
     }
-
     void* pixels = fDiscardableMemory->data();
-    if (!fGenerator->getPixels(this->info(), pixels, fRowBytes)) {
+    if (!fGenerator->getPixels(fInfo, pixels, fRowBytes)) {
         fDiscardableMemory->unlock();
         SkDELETE(fDiscardableMemory);
         fDiscardableMemory = NULL;
-        return false;
+        return NULL;
     }
-
-    rec->fPixels = pixels;
-    rec->fColorTable = NULL;
-    rec->fRowBytes = fRowBytes;
-    return true;
+    return pixels;
 }
-
 void SkDiscardablePixelRef::onUnlockPixels() {
     fDiscardableMemory->unlock();
 }
@@ -94,6 +85,7 @@
     }
     SkAutoTUnref<SkDiscardablePixelRef> ref(SkNEW_ARGS(SkDiscardablePixelRef,
                                                    (generator, info,
+                                                    dst->getSize(),
                                                     dst->rowBytes(),
                                                     factory)));
     dst->setPixelRef(ref);
diff --git a/src/lazy/SkDiscardablePixelRef.h b/src/lazy/SkDiscardablePixelRef.h
index 0a727b6..44c6df9 100644
--- a/src/lazy/SkDiscardablePixelRef.h
+++ b/src/lazy/SkDiscardablePixelRef.h
@@ -19,8 +19,7 @@
 
 protected:
     ~SkDiscardablePixelRef();
-
-    virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
+    virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
     virtual void onUnlockPixels() SK_OVERRIDE;
     virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
 
@@ -31,6 +30,8 @@
 private:
     SkImageGenerator* const fGenerator;
     SkDiscardableMemory::Factory* const fDMFactory;
+    const SkImageInfo fInfo;
+    const size_t fSize;  // size of memory to be allocated
     const size_t fRowBytes;
     // These const members should not change over the life of the
     // PixelRef, since the SkBitmap doesn't expect them to change.
@@ -40,14 +41,12 @@
     /* Takes ownership of SkImageGenerator. */
     SkDiscardablePixelRef(SkImageGenerator* generator,
                           const SkImageInfo& info,
+                          size_t size,
                           size_t rowBytes,
                           SkDiscardableMemory::Factory* factory);
-
     friend bool SkInstallDiscardablePixelRef(SkImageGenerator*,
                                              SkBitmap*,
                                              SkDiscardableMemory::Factory*);
-
     typedef SkPixelRef INHERITED;
 };
-
 #endif  // SkDiscardablePixelRef_DEFINED
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 447ce4e..4971797 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -11,7 +11,6 @@
 #include "SkCanvas.h"
 #include "SkColorPriv.h"
 #include "SkData.h"
-#include "SkDecodingImageGenerator.h"
 #include "SkError.h"
 #include "SkPaint.h"
 #include "SkPicture.h"
@@ -338,6 +337,32 @@
 }
 #endif
 
+#include "SkData.h"
+#include "SkImageRef_GlobalPool.h"
+// Class to test SkPixelRef::onRefEncodedData, since there are currently no implementations in skia.
+class SkDataImageRef : public SkImageRef_GlobalPool {
+
+public:
+    SkDataImageRef(SkMemoryStream* stream)
+        : SkImageRef_GlobalPool(stream, SkBitmap::kNo_Config) {
+        SkASSERT(stream != NULL);
+        fData = stream->copyToData();
+        this->setImmutable();
+    }
+
+    ~SkDataImageRef() {
+        fData->unref();
+    }
+
+    virtual SkData* onRefEncodedData() SK_OVERRIDE {
+        fData->ref();
+        return fData;
+    }
+
+private:
+    SkData* fData;
+};
+
 #include "SkImageEncoder.h"
 
 static SkData* encode_bitmap_to_data(size_t* offset, const SkBitmap& bm) {
@@ -379,10 +404,14 @@
         return;
     }
     SkAutoDataUnref data(wStream.copyToData());
+    SkMemoryStream memStream;
+    memStream.setData(data);
 
+    // Use the encoded bitmap as the data for an image ref.
     SkBitmap bm;
-    bool installSuccess = SkDecodingImageGenerator::Install(data, &bm);
-    REPORTER_ASSERT(reporter, installSuccess);
+    SkAutoTUnref<SkDataImageRef> imageRef(SkNEW_ARGS(SkDataImageRef, (&memStream)));
+    imageRef->getInfo(&bm);
+    bm.setPixelRef(imageRef);
 
     // Write both bitmaps to pictures, and ensure that the resulting data streams are the same.
     // Flattening original will follow the old path of performing an encode, while flattening bm
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index e0ffd7a..470221c 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -51,37 +51,35 @@
 }  // namespace
 
 DEF_TEST(PixelRef_GenIDChange, r) {
-    SkImageInfo info = { 10, 10, kPMColor_SkColorType, kPremul_SkAlphaType };
-
-    SkAutoTUnref<SkPixelRef> pixelRef(SkMallocPixelRef::NewAllocate(info, 0, NULL));
+    SkMallocPixelRef pixelRef(NULL, 0, NULL);  // We don't really care about the pixels here.
 
     // Register a listener.
     int count = 0;
-    pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+    pixelRef.addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
     REPORTER_ASSERT(r, 0 == count);
 
     // No one has looked at our pixelRef's generation ID, so invalidating it doesn't make sense.
     // (An SkPixelRef tree falls in the forest but there's nobody around to hear it.  Do we care?)
-    pixelRef->notifyPixelsChanged();
+    pixelRef.notifyPixelsChanged();
     REPORTER_ASSERT(r, 0 == count);
 
     // Force the generation ID to be calculated.
-    REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
+    REPORTER_ASSERT(r, 0 != pixelRef.getGenerationID());
 
     // Our listener was dropped in the first call to notifyPixelsChanged().  This is a no-op.
-    pixelRef->notifyPixelsChanged();
+    pixelRef.notifyPixelsChanged();
     REPORTER_ASSERT(r, 0 == count);
 
     // Force the generation ID to be recalculated, then add a listener.
-    REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
-    pixelRef->addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
-    pixelRef->notifyPixelsChanged();
+    REPORTER_ASSERT(r, 0 != pixelRef.getGenerationID());
+    pixelRef.addGenIDChangeListener(SkNEW_ARGS(TestListener, (&count)));
+    pixelRef.notifyPixelsChanged();
     REPORTER_ASSERT(r, 1 == count);
 
     // Quick check that NULL is safe.
-    REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
-    pixelRef->addGenIDChangeListener(NULL);
-    pixelRef->notifyPixelsChanged();
+    REPORTER_ASSERT(r, 0 != pixelRef.getGenerationID());
+    pixelRef.addGenIDChangeListener(NULL);
+    pixelRef.notifyPixelsChanged();
 
     test_info(r);
 }
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 448c18f..bb05432 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -149,7 +149,6 @@
     REPORTER_ASSERT(reporter, SkAlign4(bytesWritten) == bytesWritten);
 
     unsigned char dataWritten[1024];
-    SkASSERT(bytesWritten <= sizeof(dataWritten));
     writer.writeToMemory(dataWritten);
 
     // Make sure this fails when it should (test with smaller size, but still multiple of 4)
@@ -309,22 +308,10 @@
         TestBitmapSerialization(validBitmap, invalidBitmap, true, reporter);
 
         // Create a bitmap with a pixel ref too small
-        SkImageInfo info;
-        info.fWidth = 256;
-        info.fHeight = 256;
-        info.fColorType = kPMColor_SkColorType;
-        info.fAlphaType = kPremul_SkAlphaType;
-
         SkBitmap invalidBitmap2;
-        invalidBitmap2.setConfig(info);
-        
-        // Hack to force invalid, by making the pixelref smaller than its
-        // owning bitmap.
-        info.fWidth = 32;
-        info.fHeight = 1;
-        
-        invalidBitmap2.setPixelRef(SkMallocPixelRef::NewAllocate(
-                        info, invalidBitmap2.rowBytes(), NULL))->unref();
+        invalidBitmap2.setConfig(SkBitmap::kARGB_8888_Config, 256, 256);
+        invalidBitmap2.setPixelRef(SkNEW_ARGS(SkMallocPixelRef,
+            (NULL, 256, NULL)))->unref();
 
         // The deserialization should detect the pixel ref being too small and fail
         TestBitmapSerialization(validBitmap, invalidBitmap2, false, reporter);
