Chromium Code Reviews| Index: blimp/client/feature/compositor/decoding_image_generator.cc |
| diff --git a/blimp/client/feature/compositor/decoding_image_generator.cc b/blimp/client/feature/compositor/decoding_image_generator.cc |
| index 692dd373c4df152e1de69054ca0deef64b44f5bd..bf8305ea5f650d56829cce537a1f2234d084007b 100644 |
| --- a/blimp/client/feature/compositor/decoding_image_generator.cc |
| +++ b/blimp/client/feature/compositor/decoding_image_generator.cc |
| @@ -4,7 +4,9 @@ |
| #include "blimp/client/feature/compositor/decoding_image_generator.h" |
| +#include "base/numerics/safe_conversions.h" |
| #include "blimp/common/compositor/webp_decoder.h" |
| +#include "blimp/common/proto/blob_cache.pb.h" |
| #include "third_party/libwebp/webp/decode.h" |
| #include "third_party/libwebp/webp/demux.h" |
| #include "third_party/skia/include/core/SkData.h" |
| @@ -13,6 +15,16 @@ namespace blimp { |
| namespace client { |
| SkImageGenerator* DecodingImageGenerator::create(SkData* data) { |
| + // Check if this is a cache identifier instead of a WebP image. |
|
Kevin M
2016/04/13 23:29:52
Can you add a prefix byte instead of trying to par
nyquist
2016/04/14 19:33:22
Moved all of this to a proto instead.
|
| + std::unique_ptr<BlobCacheImageIdentifier> deserialized( |
| + new BlobCacheImageIdentifier); |
| + int signed_size = base::checked_cast<int>(data->size()); |
| + if (deserialized->ParseFromArray(data->data(), signed_size)) { |
| + const SkImageInfo info = SkImageInfo::MakeN32Premul(deserialized->width(), |
| + deserialized->height()); |
| + return new DecodingImageGenerator(info, data->data(), data->size()); |
| + } |
| + |
| WebPData inputData = {reinterpret_cast<const uint8_t*>(data->data()), |
| data->size()}; |
| WebPDemuxState demuxState(WEBP_DEMUX_PARSING_HEADER); |