diff options
author | scroggo <scroggo@google.com> | 2015-03-02 12:31:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-02 12:31:12 -0800 |
commit | ee1a726aed980016a9371ffa4768e0844c360eb2 (patch) | |
tree | d8095a07602a0b66d4a16744e5f9171d9e8ed9c6 /dm/DMSrcSink.cpp | |
parent | ca358852b4fed656d11107b2aaf28318a4518b49 (diff) |
Revert of Add SkCodec, including PNG implementation. (patchset #24 id:460001 of https://codereview.chromium.org/930283002/)
Reason for revert:
Breaking windows bots all over the place :(
Original issue's description:
> Add SkCodec, including PNG implementation.
>
> DM:
> Add a flag to use SkCodec instead of SkImageDecoder.
>
> SkCodec:
> Base class for codecs, allowing creation from an SkStream or an SkData.
> An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image.
> TODO: Add scanline iterator
>
> SkPngCodec:
> New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng.
> TODO: Handle other destination colortypes
> TODO: Substitute the transpose color
> TODO: Allow silencing warnings
> TODO: Use RGB instead of filler?
> TODO: sRGB
>
> SkSwizzler:
> Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling.
> TODO: Implement other swizzles.
>
> BUG=skia:3257
>
> Committed: https://skia.googlesource.com/skia/+/ca358852b4fed656d11107b2aaf28318a4518b49
TBR=reed@google.com,djsollen@google.com,msarett@google.com,mtklein@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:3257
Review URL: https://codereview.chromium.org/972743003
Diffstat (limited to 'dm/DMSrcSink.cpp')
-rw-r--r-- | dm/DMSrcSink.cpp | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 67f8ac6edb..e67d4355e4 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1,7 +1,6 @@ #include "DMSrcSink.h" #include "SamplePipeControllers.h" #include "SkCommonFlags.h" -#include "SkCodec.h" #include "SkDocument.h" #include "SkError.h" #include "SkMultiPictureDraw.h" @@ -13,8 +12,6 @@ #include "SkStream.h" #include "SkXMLWriter.h" -DEFINE_bool(codec, false, "Use SkCodec instead of SkImageDecoder"); - namespace DM { GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} @@ -49,35 +46,9 @@ Error ImageSrc::draw(SkCanvas* canvas) const { if (fDivisor == 0) { // Decode the full image. SkBitmap bitmap; - if (FLAGS_codec) { - SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); - if (!codec) { - return SkStringPrintf("Couldn't decode %s.", fPath.c_str()); - } - SkImageInfo info; - if (!codec->getInfo(&info)) { - return SkStringPrintf("Couldn't getInfo %s.", fPath.c_str()); - } - info = info.makeColorType(dstColorType); - if (info.alphaType() == kUnpremul_SkAlphaType) { - // FIXME: Currently we cannot draw unpremultiplied sources. - info = info.makeAlphaType(kPremul_SkAlphaType); - } - if (!bitmap.tryAllocPixels(info)) { - return SkStringPrintf("Image(%s) is too large (%d x %d)\n", fPath.c_str(), - info.width(), info.height()); - } - SkAutoLockPixels alp(bitmap); - const SkImageGenerator::Result result = codec->getPixels(info, bitmap.getPixels(), - bitmap.rowBytes()); - if (result != SkImageGenerator::kSuccess) { - return SkStringPrintf("Couldn't getPixels %s.", fPath.c_str()); - } - } else { - if (!SkImageDecoder::DecodeMemory(encoded->data(), encoded->size(), &bitmap, - dstColorType, SkImageDecoder::kDecodePixels_Mode)) { - return SkStringPrintf("Couldn't decode %s.", fPath.c_str()); - } + if (!SkImageDecoder::DecodeMemory(encoded->data(), encoded->size(), &bitmap, + dstColorType, SkImageDecoder::kDecodePixels_Mode)) { + return SkStringPrintf("Couldn't decode %s.", fPath.c_str()); } encoded.reset((SkData*)NULL); // Might as well drop this when we're done with it. canvas->drawBitmap(bitmap, 0,0); |