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/engine/renderer/engine_image_serialization_processor.h" | 5 #include "blimp/engine/renderer/engine_image_serialization_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 WebPConfig config; | 159 WebPConfig config; |
160 CHECK(WebPConfigInit(&config)); | 160 CHECK(WebPConfigInit(&config)); |
161 | 161 |
162 WebPPicture picture; | 162 WebPPicture picture; |
163 CHECK(WebPPictureInit(&picture)); | 163 CHECK(WebPPictureInit(&picture)); |
164 picture.width = pixmap.width(); | 164 picture.width = pixmap.width(); |
165 picture.height = pixmap.height(); | 165 picture.height = pixmap.height(); |
166 | 166 |
167 // Import picture from raw pixels. | 167 // Import picture from raw pixels. |
168 auto pixel_chars = static_cast<const unsigned char*>(pixmap.addr()); | 168 auto* pixel_chars = static_cast<const unsigned char*>(pixmap.addr()); |
169 CHECK(PlatformPictureImport(pixel_chars, &picture, pixmap.alphaType())); | 169 CHECK(PlatformPictureImport(pixel_chars, &picture, pixmap.alphaType())); |
170 | 170 |
171 // Set up the writer parameters. | 171 // Set up the writer parameters. |
172 writer_state_.size = 0; | 172 writer_state_.size = 0; |
173 picture.custom_ptr = &writer_state_; | 173 picture.custom_ptr = &writer_state_; |
174 picture.writer = &WebPMemoryWrite; | 174 picture.writer = &WebPMemoryWrite; |
175 | 175 |
176 // Setup the configuration for the output WebP picture. This is currently | 176 // Setup the configuration for the output WebP picture. This is currently |
177 // the same as the default configuration for WebP, but since any change in | 177 // the same as the default configuration for WebP, but since any change in |
178 // the WebP defaults would invalidate all caches they are hard coded. | 178 // the WebP defaults would invalidate all caches they are hard coded. |
(...skipping 22 matching lines...) Expand all Loading... |
201 } | 201 } |
202 | 202 |
203 scoped_refptr<BlobData> blob_data(new BlobData); | 203 scoped_refptr<BlobData> blob_data(new BlobData); |
204 blob_data->data.assign(reinterpret_cast<const char*>(writer_state_.mem), | 204 blob_data->data.assign(reinterpret_cast<const char*>(writer_state_.mem), |
205 writer_state_.size); | 205 writer_state_.size); |
206 return blob_data; | 206 return blob_data; |
207 } | 207 } |
208 | 208 |
209 } // namespace engine | 209 } // namespace engine |
210 } // namespace blimp | 210 } // namespace blimp |
OLD | NEW |