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
if (size < 0 || !sk_64_isS32(size))
return false;
SkImageInfo info;
if (!dst->asImageInfo(&info))
const SkImageInfo& info = dst->info();
if (kUnknown_SkColorType == info.colorType())
return false;
SkAutoTUnref<DiscardablePixelRef> pixelRef(new DiscardablePixelRef(info, dst->rowBytes(), adoptPtr(new SkMutex())));
......
......@@ -52,14 +52,14 @@ public:
virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ctable) OVERRIDE
{
SkImageInfo info;
if (!dst->asImageInfo(&info))
const SkImageInfo& info = dst->info();
if (kUnknown_SkColorType == info.colorType())
return false;
if (info != m_info || m_rowBytes != dst->rowBytes())
return false;
if (!dst->installPixels(m_info, m_pixels, m_rowBytes, 0, 0))
if (!dst->installPixels(m_info, m_pixels, m_rowBytes))
return false;
dst->lockPixels();
return true;
......
......@@ -51,10 +51,9 @@ public:
class Allocator : public SkBitmap::Allocator {
public:
virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ct) SK_OVERRIDE {
SkImageInfo info;
if (!dst->asImageInfo(&info)) {
const SkImageInfo& info = dst->info();
if (kUnknown_SkColorType == info.colorType())
return false;
}
SkAutoTUnref<SkPixelRef> pr(new MockDiscardablePixelRef(info, dst->rowBytes()));
dst->setPixelRef(pr);
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