Commit 70c0a836 authored by reed@google.com's avatar reed@google.com
parent 95ffd07b
...@@ -48,8 +48,8 @@ bool DiscardablePixelRefAllocator::allocPixelRef(SkBitmap* dst, SkColorTable* ct ...@@ -48,8 +48,8 @@ bool DiscardablePixelRefAllocator::allocPixelRef(SkBitmap* dst, SkColorTable* ct
if (size < 0 || !sk_64_isS32(size)) if (size < 0 || !sk_64_isS32(size))
return false; return false;
SkImageInfo info; const SkImageInfo& info = dst->info();
if (!dst->asImageInfo(&info)) if (kUnknown_SkColorType == info.colorType())
return false; return false;
SkAutoTUnref<DiscardablePixelRef> pixelRef(new DiscardablePixelRef(info, dst->rowBytes(), adoptPtr(new SkMutex()))); SkAutoTUnref<DiscardablePixelRef> pixelRef(new DiscardablePixelRef(info, dst->rowBytes(), adoptPtr(new SkMutex())));
......
...@@ -52,14 +52,14 @@ public: ...@@ -52,14 +52,14 @@ public:
virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) OVERRIDE virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) OVERRIDE
{ {
SkImageInfo info; const SkImageInfo& info = dst->info();
if (!dst->asImageInfo(&info)) if (kUnknown_SkColorType == info.colorType())
return false; return false;
if (info != m_info || m_rowBytes != dst->rowBytes()) if (info != m_info || m_rowBytes != dst->rowBytes())
return false; return false;
if (!dst->installPixels(m_info, m_pixels, m_rowBytes, 0, 0)) if (!dst->installPixels(m_info, m_pixels, m_rowBytes))
return false; return false;
dst->lockPixels(); dst->lockPixels();
return true; return true;
......
...@@ -51,10 +51,9 @@ public: ...@@ -51,10 +51,9 @@ public:
class Allocator : public SkBitmap::Allocator { class Allocator : public SkBitmap::Allocator {
public: public:
virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ct) SK_OVERRIDE { virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ct) SK_OVERRIDE {
SkImageInfo info; const SkImageInfo& info = dst->info();
if (!dst->asImageInfo(&info)) { if (kUnknown_SkColorType == info.colorType())
return false; return false;
}
SkAutoTUnref<SkPixelRef> pr(new MockDiscardablePixelRef(info, dst->rowBytes())); SkAutoTUnref<SkPixelRef> pr(new MockDiscardablePixelRef(info, dst->rowBytes()));
dst->setPixelRef(pr); dst->setPixelRef(pr);
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment