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

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

Issue 1460523002: GIF decoding to Index8, unit tests and misusing unit test as benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup. tableChanged was wrong - do proper check. Created 5 years 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (oldSize != newSize) { 122 if (oldSize != newSize) {
123 m_frameBufferCache.resize(newSize); 123 m_frameBufferCache.resize(newSize);
124 for (size_t i = oldSize; i < newSize; ++i) { 124 for (size_t i = oldSize; i < newSize; ++i) {
125 m_frameBufferCache[i].setPremultiplyAlpha(m_premultiplyAlpha); 125 m_frameBufferCache[i].setPremultiplyAlpha(m_premultiplyAlpha);
126 initializeNewFrame(i); 126 initializeNewFrame(i);
127 } 127 }
128 } 128 }
129 return newSize; 129 return newSize;
130 } 130 }
131 131
132 ImageFrame* ImageDecoder::frameBufferAtIndex(size_t index) 132 ImageFrame* ImageDecoder::frameBufferAtIndex(size_t index, ImageFrame::ColorType outputColor)
133 { 133 {
134 if (index >= frameCount()) 134 if (index >= frameCount())
135 return 0; 135 return 0;
136 136
137 ImageFrame* frame = &m_frameBufferCache[index]; 137 ImageFrame* frame = &m_frameBufferCache[index];
138 if (frame->status() != ImageFrame::FrameComplete) { 138 if (frame->status() != ImageFrame::FrameComplete) {
scroggo_chromium 2015/12/03 21:47:21 It appears that if the frame was complete, it look
aleksandar.stojiljkovic 2015/12/04 00:07:34 Yes, RELEASE_ASSERT there needed.
139 PlatformInstrumentation::willDecodeImage(filenameExtension()); 139 PlatformInstrumentation::willDecodeImage(filenameExtension());
140 decode(index); 140 decodeTo(index, outputColor);
141 PlatformInstrumentation::didDecodeImage(); 141 PlatformInstrumentation::didDecodeImage();
142 } 142 }
143 143
144 frame->notifyBitmapIfPixelsChanged(); 144 frame->notifyBitmapIfPixelsChanged();
145 return frame; 145 return frame;
146 } 146 }
147 147
148 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const 148 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const
149 { 149 {
150 return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAlpha( ); 150 return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAlpha( );
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return m_planes[i]; 255 return m_planes[i];
256 } 256 }
257 257
258 size_t ImagePlanes::rowBytes(int i) const 258 size_t ImagePlanes::rowBytes(int i) const
259 { 259 {
260 ASSERT((i >= 0) && i < 3); 260 ASSERT((i >= 0) && i < 3);
261 return m_rowBytes[i]; 261 return m_rowBytes[i];
262 } 262 }
263 263
264 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698