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

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: DCHECK in ImageFrame::copy/take. 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 if (frame->getStatus() == ImageFrame::FrameComplete)
121 return fromSkSp(frame->finalizePixelsAndGetImage());
120 return fromSkSp(SkImage::MakeFromBitmap(frame->bitmap())); 122 return fromSkSp(SkImage::MakeFromBitmap(frame->bitmap()));
Peter Kasting 2016/09/22 21:44:08 Nit: Avoids duplicating fromSkSp() call: return
aleksandar.stojiljkovic 2016/09/27 18:08:28 Done. The most recent refactoring removed the need
121 } 123 }
122 124
123 PassRefPtr<SharedBuffer> DeferredImageDecoder::data() 125 PassRefPtr<SharedBuffer> DeferredImageDecoder::data()
124 { 126 {
125 if (!m_rwBuffer) 127 if (!m_rwBuffer)
126 return nullptr; 128 return nullptr;
127 RefPtr<SkROBuffer> roBuffer = adoptRef(m_rwBuffer->newRBufferSnapshot()); 129 RefPtr<SkROBuffer> roBuffer = adoptRef(m_rwBuffer->newRBufferSnapshot());
128 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(); 130 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create();
129 SkROBuffer::Iter it(roBuffer.get()); 131 SkROBuffer::Iter it(roBuffer.get());
130 do { 132 do {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 341 }
340 342
341 } // namespace blink 343 } // namespace blink
342 344
343 namespace WTF { 345 namespace WTF {
344 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> { 346 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> {
345 STATIC_ONLY(VectorTraits); 347 STATIC_ONLY(VectorTraits);
346 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0. 348 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0.
347 }; 349 };
348 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698