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

Side by Side Diff: Source/core/platform/graphics/ImageSource.cpp

Issue 15350006: Decode GIF image frames on demand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 7 years, 6 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> 3 * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
4 * Copyright (C) 2008, Google Inc. All rights reserved. 4 * Copyright (C) 2008, Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 27 matching lines...) Expand all
38 namespace WebCore { 38 namespace WebCore {
39 39
40 ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::Gamm aAndColorProfileOption gammaAndColorProfileOption) 40 ImageSource::ImageSource(ImageSource::AlphaOption alphaOption, ImageSource::Gamm aAndColorProfileOption gammaAndColorProfileOption)
41 : m_alphaOption(alphaOption) 41 : m_alphaOption(alphaOption)
42 , m_gammaAndColorProfileOption(gammaAndColorProfileOption) 42 , m_gammaAndColorProfileOption(gammaAndColorProfileOption)
43 { 43 {
44 } 44 }
45 45
46 ImageSource::~ImageSource() 46 ImageSource::~ImageSource()
47 { 47 {
48 clear(true);
49 } 48 }
50 49
51 void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) 50 size_t ImageSource::clearCacheExceptFrame(size_t clearExceptFrame)
52 { 51 {
53 if (!destroyAll) { 52 return m_decoder ? m_decoder->clearCacheExceptFrame(clearExceptFrame) : 0;
54 if (m_decoder)
55 m_decoder->clearFrameBufferCache(clearBeforeFrame);
56 return;
57 }
58
59 m_decoder.clear();
60 if (data)
61 setData(data, allDataReceived);
62 } 53 }
63 54
64 bool ImageSource::initialized() const 55 bool ImageSource::initialized() const
65 { 56 {
66 return m_decoder; 57 return m_decoder;
67 } 58 }
68 59
69 void ImageSource::setData(SharedBuffer* data, bool allDataReceived) 60 void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
70 { 61 {
71 // Make the decoder by sniffing the bytes. 62 // Make the decoder by sniffing the bytes.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return m_decoder->frameBytesAtIndex(index); 173 return m_decoder->frameBytesAtIndex(index);
183 } 174 }
184 175
185 void ImageSource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 176 void ImageSource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
186 { 177 {
187 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); 178 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
188 info.addMember(m_decoder, "decoder"); 179 info.addMember(m_decoder, "decoder");
189 } 180 }
190 181
191 } 182 }
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/ImageSource.h ('k') | Source/core/platform/graphics/chromium/DeferredImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698