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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.cpp

Issue 2897953002: Remove loop unrolling code in UpdateYUVComponentSizes. (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 i = 0; i < 3; ++i) {
Srirama 2017/05/22 13:29:30 Suggestion: may be use componentIndex or some othe
105 component_sizes[0].set(size.Width(), size.Height()); 105 IntSize size = decoder->DecodedYUVSize(i);
106 component_width_bytes[0] = decoder->DecodedYUVWidthBytes(0); 106 component_sizes[i].set(size.Width(), size.Height());
107 size = decoder->DecodedYUVSize(1); 107 component_width_bytes[i] = decoder->DecodedYUVWidthBytes(i);
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698