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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp

Issue 2879123003: blink: Fix frame completion querying for static images. (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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (!has_histogrammed_color_space_) { 175 if (!has_histogrammed_color_space_) {
176 BitmapImageMetrics::CountImageGammaAndGamut(embedded_color_space_.get()); 176 BitmapImageMetrics::CountImageGammaAndGamut(embedded_color_space_.get());
177 has_histogrammed_color_space_ = true; 177 has_histogrammed_color_space_ = true;
178 } 178 }
179 179
180 frame->NotifyBitmapIfPixelsChanged(); 180 frame->NotifyBitmapIfPixelsChanged();
181 return frame; 181 return frame;
182 } 182 }
183 183
184 bool ImageDecoder::FrameHasAlphaAtIndex(size_t index) const { 184 bool ImageDecoder::FrameHasAlphaAtIndex(size_t index) const {
185 return !FrameIsCompleteAtIndex(index) || 185 return index < frame_buffer_cache_.size() &&
urvang 2017/05/15 17:33:07 Shouldn't you call "FrameIsDecodedAtIndex()" now i
Khushal 2017/05/15 17:55:17 FrameIsDecodedAtIndex is true only if the decoded
urvang 2017/05/15 18:02:10 Yes, if keeping the current call still works, you
Khushal 2017/05/15 20:44:48 Done.
186 frame_buffer_cache_[index].HasAlpha(); 186 frame_buffer_cache_[index].HasAlpha();
187 } 187 }
188 188
189 bool ImageDecoder::FrameIsCompleteAtIndex(size_t index) const { 189 bool ImageDecoder::FrameIsCompleteAtIndex(size_t index) const {
190 return (index < frame_buffer_cache_.size()) && 190 // Animated images override this method to return the status based on the data
191 (frame_buffer_cache_[index].GetStatus() == ImageFrame::kFrameComplete); 191 // received for the queried frame.
192 return IsAllDataReceived();
urvang 2017/05/15 17:33:07 I'm curious if you get a warning about "index" bei
Khushal 2017/05/15 17:55:17 The bots don't seem to be complaining.
urvang 2017/05/15 18:02:10 Acknowledged.
193 }
194
195 bool ImageDecoder::FrameIsDecodedAtIndex(size_t index) const {
196 return index < frame_buffer_cache_.size() &&
197 frame_buffer_cache_[index].GetStatus() == ImageFrame::kFrameComplete;
192 } 198 }
193 199
194 size_t ImageDecoder::FrameBytesAtIndex(size_t index) const { 200 size_t ImageDecoder::FrameBytesAtIndex(size_t index) const {
195 if (index >= frame_buffer_cache_.size() || 201 if (index >= frame_buffer_cache_.size() ||
196 frame_buffer_cache_[index].GetStatus() == ImageFrame::kFrameEmpty) 202 frame_buffer_cache_[index].GetStatus() == ImageFrame::kFrameEmpty)
197 return 0; 203 return 0;
198 204
199 struct ImageSize { 205 struct ImageSize {
200 explicit ImageSize(IntSize size) { 206 explicit ImageSize(IntSize size) {
201 area = static_cast<uint64_t>(size.Width()) * size.Height(); 207 area = static_cast<uint64_t>(size.Width()) * size.Height();
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 583 }
578 584
579 // For color spaces without an identifiable gamut, just fall through to 585 // For color spaces without an identifiable gamut, just fall through to
580 // sRGB. 586 // sRGB.
581 } 587 }
582 588
583 return SkColorSpace::MakeSRGB(); 589 return SkColorSpace::MakeSRGB();
584 } 590 }
585 591
586 } // namespace blink 592 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698