OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void* pixels_; | 94 void* pixels_; |
95 size_t row_bytes_; | 95 size_t row_bytes_; |
96 }; | 96 }; |
97 | 97 |
98 static bool UpdateYUVComponentSizes(ImageDecoder* decoder, | 98 static bool UpdateYUVComponentSizes(ImageDecoder* decoder, |
99 SkISize component_sizes[3], | 99 SkISize component_sizes[3], |
100 size_t component_width_bytes[3]) { | 100 size_t component_width_bytes[3]) { |
101 if (!decoder->CanDecodeToYUV()) | 101 if (!decoder->CanDecodeToYUV()) |
102 return false; | 102 return false; |
103 | 103 |
104 IntSize size = decoder->DecodedYUVSize(0); | 104 for (int yuv_index = 0; yuv_index < 3; ++yuv_index) { |
105 component_sizes[0].set(size.Width(), size.Height()); | 105 IntSize size = decoder->DecodedYUVSize(yuv_index); |
106 component_width_bytes[0] = decoder->DecodedYUVWidthBytes(0); | 106 component_sizes[yuv_index].set(size.Width(), size.Height()); |
107 size = decoder->DecodedYUVSize(1); | 107 component_width_bytes[yuv_index] = decoder->DecodedYUVWidthBytes(yuv_index); |
108 component_sizes[1].set(size.Width(), size.Height()); | 108 } |
109 component_width_bytes[1] = decoder->DecodedYUVWidthBytes(1); | 109 |
110 size = decoder->DecodedYUVSize(2); | |
111 component_sizes[2].set(size.Width(), size.Height()); | |
112 component_width_bytes[2] = decoder->DecodedYUVWidthBytes(2); | |
113 return true; | 110 return true; |
114 } | 111 } |
115 | 112 |
116 ImageFrameGenerator::ImageFrameGenerator(const SkISize& full_size, | 113 ImageFrameGenerator::ImageFrameGenerator(const SkISize& full_size, |
117 bool is_multi_frame, | 114 bool is_multi_frame, |
118 const ColorBehavior& color_behavior) | 115 const ColorBehavior& color_behavior) |
119 : full_size_(full_size), | 116 : full_size_(full_size), |
120 decoder_color_behavior_(color_behavior), | 117 decoder_color_behavior_(color_behavior), |
121 is_multi_frame_(is_multi_frame), | 118 is_multi_frame_(is_multi_frame), |
122 decode_failed_(false), | 119 decode_failed_(false), |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // do YUV decoding. | 394 // do YUV decoding. |
398 std::unique_ptr<ImagePlanes> dummy_image_planes = | 395 std::unique_ptr<ImagePlanes> dummy_image_planes = |
399 WTF::WrapUnique(new ImagePlanes); | 396 WTF::WrapUnique(new ImagePlanes); |
400 decoder->SetImagePlanes(std::move(dummy_image_planes)); | 397 decoder->SetImagePlanes(std::move(dummy_image_planes)); |
401 | 398 |
402 return UpdateYUVComponentSizes(decoder.get(), size_info->fSizes, | 399 return UpdateYUVComponentSizes(decoder.get(), size_info->fSizes, |
403 size_info->fWidthBytes); | 400 size_info->fWidthBytes); |
404 } | 401 } |
405 | 402 |
406 } // namespace blink | 403 } // namespace blink |
OLD | NEW |