| OLD | NEW |
| 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/blimp_image_decoder.h" | 5 #include "blimp/client/feature/compositor/blimp_image_decoder.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "blimp/common/blob_cache/blob_cache.h" | 11 #include "blimp/common/blob_cache/blob_cache.h" |
| 12 #include "blimp/common/blob_cache/id_util.h" | 12 #include "blimp/common/blob_cache/id_util.h" |
| 13 #include "blimp/common/blob_cache/in_memory_blob_cache.h" | 13 #include "blimp/common/blob_cache/in_memory_blob_cache.h" |
| 14 #include "blimp/common/proto/blob_cache.pb.h" | 14 #include "blimp/common/proto/blob_cache.pb.h" |
| 15 #include "third_party/libwebp/webp/decode.h" | 15 #include "third_party/libwebp/webp/decode.h" |
| 16 #include "third_party/libwebp/webp/demux.h" | 16 #include "third_party/libwebp/webp/demux.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 | 18 |
| 19 namespace blimp { | 19 namespace blimp { |
| 20 namespace client { | 20 namespace client { |
| 21 | 21 |
| 22 bool BlimpImageDecoder(const void* input, size_t input_size, SkBitmap* bitmap) { | 22 bool DecodeBlimpImage(const void* input, size_t input_size, SkBitmap* bitmap) { |
| 23 DCHECK(bitmap); | 23 DCHECK(bitmap); |
| 24 | 24 |
| 25 // Initialize an empty WebPDecoderConfig. | 25 // Initialize an empty WebPDecoderConfig. |
| 26 WebPDecoderConfig config; | 26 WebPDecoderConfig config; |
| 27 if (!WebPInitDecoderConfig(&config)) { | 27 if (!WebPInitDecoderConfig(&config)) { |
| 28 LOG(WARNING) << "Failed to initialize WebP config."; | 28 LOG(WARNING) << "Failed to initialize WebP config."; |
| 29 return false; | 29 return false; |
| 30 } | 30 } |
| 31 | 31 |
| 32 WebPData webp_data; | 32 WebPData webp_data; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (!success) { | 79 if (!success) { |
| 80 LOG(WARNING) << "Failed to decode WebP data."; | 80 LOG(WARNING) << "Failed to decode WebP data."; |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace client | 87 } // namespace client |
| 88 } // namespace blimp | 88 } // namespace blimp |
| OLD | NEW |