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

Side by Side Diff: Source/core/platform/image-decoders/skia/ImageDecoderSkia.cpp

Issue 15969015: Reland again "Decode GIF image frames on demand". (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing 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 | Annotate | Revision Log
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) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
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 22 matching lines...) Expand all
33 namespace WebCore { 33 namespace WebCore {
34 34
35 ImageFrame::ImageFrame() 35 ImageFrame::ImageFrame()
36 : m_bitmap(NativeImageSkia::create()) 36 : m_bitmap(NativeImageSkia::create())
37 , m_allocator(0) 37 , m_allocator(0)
38 , m_hasAlpha(false) 38 , m_hasAlpha(false)
39 , m_status(FrameEmpty) 39 , m_status(FrameEmpty)
40 , m_duration(0) 40 , m_duration(0)
41 , m_disposalMethod(DisposeNotSpecified) 41 , m_disposalMethod(DisposeNotSpecified)
42 , m_premultiplyAlpha(true) 42 , m_premultiplyAlpha(true)
43 , m_requiredPreviousFrameIndex(notFound)
44 #if !ASSERT_DISABLED
45 , m_requiredPreviousFrameIndexValid(false)
46 #endif
43 { 47 {
44 } 48 }
45 49
46 ImageFrame& ImageFrame::operator=(const ImageFrame& other) 50 ImageFrame& ImageFrame::operator=(const ImageFrame& other)
47 { 51 {
48 if (this == &other) 52 if (this == &other)
49 return *this; 53 return *this;
50 54
51 m_bitmap = other.m_bitmap->clone(); 55 m_bitmap = other.m_bitmap->clone();
52 // Keep the pixels locked since we will be writing directly into the 56 // Keep the pixels locked since we will be writing directly into the
53 // bitmap throughout this object's lifetime. 57 // bitmap throughout this object's lifetime.
54 m_bitmap->bitmap().lockPixels(); 58 m_bitmap->bitmap().lockPixels();
55 setMemoryAllocator(other.allocator()); 59 setMemoryAllocator(other.allocator());
56 setOriginalFrameRect(other.originalFrameRect()); 60 setOriginalFrameRect(other.originalFrameRect());
57 setStatus(other.status()); 61 setStatus(other.status());
58 setDuration(other.duration()); 62 setDuration(other.duration());
59 setDisposalMethod(other.disposalMethod()); 63 setDisposalMethod(other.disposalMethod());
60 setPremultiplyAlpha(other.premultiplyAlpha()); 64 setPremultiplyAlpha(other.premultiplyAlpha());
61 // Be sure that this is called after we've called setStatus(), since we 65 // Be sure that this is called after we've called setStatus(), since we
62 // look at our status to know what to do with the alpha value. 66 // look at our status to know what to do with the alpha value.
63 setHasAlpha(other.hasAlpha()); 67 setHasAlpha(other.hasAlpha());
68 // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex().
69 m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex;
70 #if !ASSERT_DISABLED
71 m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid;
72 #endif
64 return *this; 73 return *this;
65 } 74 }
66 75
67 void ImageFrame::clearPixelData() 76 void ImageFrame::clearPixelData()
68 { 77 {
69 m_bitmap->bitmap().reset(); 78 m_bitmap->bitmap().reset();
70 m_status = FrameEmpty; 79 m_status = FrameEmpty;
71 // NOTE: Do not reset other members here; clearFrameBufferCache() 80 // NOTE: Do not reset other members here; clearFrameBufferCache()
72 // calls this to free the bitmap data, but other functions like 81 // calls this to free the bitmap data, but other functions like
73 // initFrameBuffer() and frameComplete() may still need to read 82 // initFrameBuffer() and frameComplete() may still need to read
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 145 }
137 } 146 }
138 147
139 void ImageFrame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 148 void ImageFrame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
140 { 149 {
141 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image); 150 MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
142 info.addMember(m_bitmap, "bitmap"); 151 info.addMember(m_bitmap, "bitmap");
143 } 152 }
144 153
145 } // namespace WebCore 154 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698