Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: blimp/client/feature/compositor/decoding_image_generator.cc

Issue 1867653002: Initial version of Blimp BlobCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test name to new API Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | blimp/common/BUILD.gn » ('j') | blimp/common/blob_cache/blob_cache.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/client/feature/compositor/decoding_image_generator.h" 5 #include "blimp/client/feature/compositor/decoding_image_generator.h"
6 6
7 #include "base/numerics/safe_conversions.h"
7 #include "blimp/common/compositor/webp_decoder.h" 8 #include "blimp/common/compositor/webp_decoder.h"
9 #include "blimp/common/proto/blob_cache.pb.h"
8 #include "third_party/libwebp/webp/decode.h" 10 #include "third_party/libwebp/webp/decode.h"
9 #include "third_party/libwebp/webp/demux.h" 11 #include "third_party/libwebp/webp/demux.h"
10 #include "third_party/skia/include/core/SkData.h" 12 #include "third_party/skia/include/core/SkData.h"
11 13
12 namespace blimp { 14 namespace blimp {
13 namespace client { 15 namespace client {
14 16
15 SkImageGenerator* DecodingImageGenerator::create(SkData* data) { 17 SkImageGenerator* DecodingImageGenerator::create(SkData* data) {
18 // 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.
19 std::unique_ptr<BlobCacheImageIdentifier> deserialized(
20 new BlobCacheImageIdentifier);
21 int signed_size = base::checked_cast<int>(data->size());
22 if (deserialized->ParseFromArray(data->data(), signed_size)) {
23 const SkImageInfo info = SkImageInfo::MakeN32Premul(deserialized->width(),
24 deserialized->height());
25 return new DecodingImageGenerator(info, data->data(), data->size());
26 }
27
16 WebPData inputData = {reinterpret_cast<const uint8_t*>(data->data()), 28 WebPData inputData = {reinterpret_cast<const uint8_t*>(data->data()),
17 data->size()}; 29 data->size()};
18 WebPDemuxState demuxState(WEBP_DEMUX_PARSING_HEADER); 30 WebPDemuxState demuxState(WEBP_DEMUX_PARSING_HEADER);
19 WebPDemuxer* demux = WebPDemuxPartial(&inputData, &demuxState); 31 WebPDemuxer* demux = WebPDemuxPartial(&inputData, &demuxState);
20 32
21 uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH); 33 uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
22 uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT); 34 uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
23 35
24 const SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); 36 const SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
25 return new DecodingImageGenerator(info, data->data(), data->size()); 37 return new DecodingImageGenerator(info, data->data(), data->size());
(...skipping 26 matching lines...) Expand all
52 return false; 64 return false;
53 } 65 }
54 66
55 bool DecodingImageGenerator::onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, 67 bool DecodingImageGenerator::onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo,
56 void* planes[3]) { 68 void* planes[3]) {
57 return false; 69 return false;
58 } 70 }
59 71
60 } // namespace client 72 } // namespace client
61 } // namespace blimp 73 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | blimp/common/BUILD.gn » ('j') | blimp/common/blob_cache/blob_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698