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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 2155973002: Save a bitmap copy when advancing to dependent GIF and WebP animation frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: finalizePixelsAndGetImage. Created 4 years, 3 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return createFrameImageAtIndex(index, !m_frameGenerator->hasAlpha(index) ); 110 return createFrameImageAtIndex(index, !m_frameGenerator->hasAlpha(index) );
111 } 111 }
112 112
113 if (!m_actualDecoder || m_actualDecoder->failed()) 113 if (!m_actualDecoder || m_actualDecoder->failed())
114 return nullptr; 114 return nullptr;
115 115
116 ImageFrame* frame = m_actualDecoder->frameBufferAtIndex(index); 116 ImageFrame* frame = m_actualDecoder->frameBufferAtIndex(index);
117 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty) 117 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty)
118 return nullptr; 118 return nullptr;
119 119
120 return fromSkSp(SkImage::MakeFromBitmap(frame->bitmap())); 120 return frame->finalizePixelsAndGetImage();
121 } 121 }
122 122
123 PassRefPtr<SharedBuffer> DeferredImageDecoder::data() 123 PassRefPtr<SharedBuffer> DeferredImageDecoder::data()
124 { 124 {
125 if (!m_rwBuffer) 125 if (!m_rwBuffer)
126 return nullptr; 126 return nullptr;
127 RefPtr<SkROBuffer> roBuffer = adoptRef(m_rwBuffer->newRBufferSnapshot()); 127 RefPtr<SkROBuffer> roBuffer = adoptRef(m_rwBuffer->newRBufferSnapshot());
128 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(); 128 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create();
129 SkROBuffer::Iter it(roBuffer.get()); 129 SkROBuffer::Iter it(roBuffer.get());
130 do { 130 do {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 } // namespace blink 341 } // namespace blink
342 342
343 namespace WTF { 343 namespace WTF {
344 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> { 344 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> {
345 STATIC_ONLY(VectorTraits); 345 STATIC_ONLY(VectorTraits);
346 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0. 346 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0.
347 }; 347 };
348 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698