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

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

Issue 14317005: Checking if frame is complete and access duration doesn't need a decode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: done Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 PassNativeImagePtr BitmapImage::frameAtIndex(size_t index) 302 PassNativeImagePtr BitmapImage::frameAtIndex(size_t index)
303 { 303 {
304 if (!ensureFrameIsCached(index)) 304 if (!ensureFrameIsCached(index))
305 return 0; 305 return 0;
306 return m_frames[index].m_frame; 306 return m_frames[index].m_frame;
307 } 307 }
308 308
309 bool BitmapImage::frameIsCompleteAtIndex(size_t index) 309 bool BitmapImage::frameIsCompleteAtIndex(size_t index)
310 { 310 {
311 if (!ensureFrameIsCached(index)) 311 if (index < m_frames.size() && m_frames[index].m_haveMetadata && m_frames[in dex].m_isComplete)
312 return false; 312 return true;
313 return m_frames[index].m_isComplete; 313 return m_source.frameIsCompleteAtIndex(index);
314 } 314 }
315 315
316 float BitmapImage::frameDurationAtIndex(size_t index) 316 float BitmapImage::frameDurationAtIndex(size_t index)
317 { 317 {
318 if (!ensureFrameIsCached(index)) 318 if (index < m_frames.size() && m_frames[index].m_haveMetadata)
319 return 0; 319 return m_frames[index].m_duration;
320 return m_frames[index].m_duration; 320 return m_source.frameDurationAtIndex(index);
321 } 321 }
322 322
323 PassNativeImagePtr BitmapImage::nativeImageForCurrentFrame() 323 PassNativeImagePtr BitmapImage::nativeImageForCurrentFrame()
324 { 324 {
325 return frameAtIndex(currentFrame()); 325 return frameAtIndex(currentFrame());
326 } 326 }
327 327
328 bool BitmapImage::frameHasAlphaAtIndex(size_t index) 328 bool BitmapImage::frameHasAlphaAtIndex(size_t index)
329 { 329 {
330 if (m_frames.size() <= index) 330 if (m_frames.size() <= index)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 581 }
582 582
583 void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 583 void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
584 { 584 {
585 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); 585 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
586 memoryObjectInfo->setClassName("FrameData"); 586 memoryObjectInfo->setClassName("FrameData");
587 info.addMember(m_frame, "frame", WTF::RetainingPointer); 587 info.addMember(m_frame, "frame", WTF::RetainingPointer);
588 } 588 }
589 589
590 } 590 }
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp ('k') | Source/core/platform/graphics/ImageSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698