Chromium Code Reviews| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 if (bitmap.getPixels() != pixels) | 162 if (bitmap.getPixels() != pixels) |
| 163 CopyPixels(pixels, row_bytes, bitmap.getPixels(), bitmap.rowBytes(), info); | 163 CopyPixels(pixels, row_bytes, bitmap.getPixels(), bitmap.rowBytes(), info); |
| 164 return true; | 164 return true; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool ImageFrameGenerator::DecodeToYUV(SegmentReader* data, | 167 bool ImageFrameGenerator::DecodeToYUV(SegmentReader* data, |
| 168 size_t index, | 168 size_t index, |
| 169 const SkISize component_sizes[3], | 169 const SkISize component_sizes[3], |
| 170 void* planes[3], | 170 void* planes[3], |
| 171 const size_t row_bytes[3]) { | 171 const size_t row_bytes[3]) { |
| 172 // TODO (scroggo): The only interesting thing this uses from the | |
| 173 // ImageFrameGenerator is m_decodeFailed. Move this into | |
| 174 // DecodingImageGenerator, which is the only class that calls it. | |
| 175 if (decode_failed_) | |
|
scroggo_chromium
2017/06/15 14:50:33
The motivation for this check is that if the image
naga
2017/06/15 15:05:25
In the current code decode_failed_ variable is not
scroggo_chromium
2017/06/15 16:46:19
I disagree. Here's how it's related: If decode_fai
naga
2017/06/15 16:59:20
decode_failed_ variable status is updated on Decod
| |
| 176 return false; | |
| 177 | 172 |
| 178 TRACE_EVENT1("blink", "ImageFrameGenerator::decodeToYUV", "frame index", | 173 TRACE_EVENT1("blink", "ImageFrameGenerator::decodeToYUV", "frame index", |
| 179 static_cast<int>(index)); | 174 static_cast<int>(index)); |
| 180 | 175 |
| 181 if (!planes || !planes[0] || !planes[1] || !planes[2] || !row_bytes || | 176 if (!planes || !planes[0] || !planes[1] || !planes[2] || !row_bytes || |
| 182 !row_bytes[0] || !row_bytes[1] || !row_bytes[2]) { | 177 !row_bytes[0] || !row_bytes[1] || !row_bytes[2]) { |
| 183 return false; | 178 return false; |
| 184 } | 179 } |
| 185 | 180 |
| 186 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::Create( | 181 std::unique_ptr<ImageDecoder> decoder = ImageDecoder::Create( |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 // do YUV decoding. | 389 // do YUV decoding. |
| 395 std::unique_ptr<ImagePlanes> dummy_image_planes = | 390 std::unique_ptr<ImagePlanes> dummy_image_planes = |
| 396 WTF::WrapUnique(new ImagePlanes); | 391 WTF::WrapUnique(new ImagePlanes); |
| 397 decoder->SetImagePlanes(std::move(dummy_image_planes)); | 392 decoder->SetImagePlanes(std::move(dummy_image_planes)); |
| 398 | 393 |
| 399 return UpdateYUVComponentSizes(decoder.get(), size_info->fSizes, | 394 return UpdateYUVComponentSizes(decoder.get(), size_info->fSizes, |
| 400 size_info->fWidthBytes); | 395 size_info->fWidthBytes); |
| 401 } | 396 } |
| 402 | 397 |
| 403 } // namespace blink | 398 } // namespace blink |
| OLD | NEW |