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

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 m_status in ImageFrame. Shortened commit message. Thanks kbr@. Created 4 years, 2 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return createFrameImageAtIndex(index, !m_frameGenerator->hasAlpha(index) ); 118 return createFrameImageAtIndex(index, !m_frameGenerator->hasAlpha(index) );
119 } 119 }
120 120
121 if (!m_actualDecoder || m_actualDecoder->failed()) 121 if (!m_actualDecoder || m_actualDecoder->failed())
122 return nullptr; 122 return nullptr;
123 123
124 ImageFrame* frame = m_actualDecoder->frameBufferAtIndex(index); 124 ImageFrame* frame = m_actualDecoder->frameBufferAtIndex(index);
125 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty) 125 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty)
126 return nullptr; 126 return nullptr;
127 127
128 return SkImage::MakeFromBitmap(frame->bitmap()); 128 return (frame->getStatus() == ImageFrame::FrameComplete) ? frame->finalizePi xelsAndGetImage() : SkImage::MakeFromBitmap(frame->bitmap());
129 } 129 }
130 130
131 PassRefPtr<SharedBuffer> DeferredImageDecoder::data() 131 PassRefPtr<SharedBuffer> DeferredImageDecoder::data()
132 { 132 {
133 if (!m_rwBuffer) 133 if (!m_rwBuffer)
134 return nullptr; 134 return nullptr;
135 sk_sp<SkROBuffer> roBuffer(m_rwBuffer->newRBufferSnapshot()); 135 sk_sp<SkROBuffer> roBuffer(m_rwBuffer->newRBufferSnapshot());
136 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(); 136 RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create();
137 SkROBuffer::Iter it(roBuffer.get()); 137 SkROBuffer::Iter it(roBuffer.get());
138 do { 138 do {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 354 }
355 355
356 } // namespace blink 356 } // namespace blink
357 357
358 namespace WTF { 358 namespace WTF {
359 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> { 359 template<> struct VectorTraits<blink::DeferredFrameData> : public SimpleClassVec torTraits<blink::DeferredFrameData> {
360 STATIC_ONLY(VectorTraits); 360 STATIC_ONLY(VectorTraits);
361 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0. 361 static const bool canInitializeWithMemset = false; // Not all DeferredFrameD ata members initialize to 0.
362 }; 362 };
363 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698