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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h

Issue 2930513004: [WIP] Move ImageDecoders to SkCodec
Patch Set: Adding check for decoder creation Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
deleted file mode 100644
index 483f213e8cdabf2a8eaf9a4b10dbe8bc7d7971be..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WEBPImageDecoder_h
-#define WEBPImageDecoder_h
-
-#include "platform/image-decoders/ImageDecoder.h"
-#include "third_party/skia/include/core/SkData.h"
-#include "webp/decode.h"
-#include "webp/demux.h"
-
-namespace blink {
-
-class PLATFORM_EXPORT WEBPImageDecoder final : public ImageDecoder {
- WTF_MAKE_NONCOPYABLE(WEBPImageDecoder);
-
- public:
- WEBPImageDecoder(AlphaOption, const ColorBehavior&, size_t max_decoded_bytes);
- ~WEBPImageDecoder() override;
-
- // ImageDecoder:
- String FilenameExtension() const override { return "webp"; }
- void OnSetData(SegmentReader* data) override;
- int RepetitionCount() const override;
- bool FrameIsCompleteAtIndex(size_t) const override;
- float FrameDurationAtIndex(size_t) const override;
-
- private:
- // ImageDecoder:
- virtual void DecodeSize() { UpdateDemuxer(); }
- size_t DecodeFrameCount() override;
- void InitializeNewFrame(size_t) override;
- void Decode(size_t) override;
-
- bool DecodeSingleFrame(const uint8_t* data_bytes,
- size_t data_size,
- size_t frame_index);
-
- // For WebP images, the frame status needs to be FrameComplete to decode
- // subsequent frames that depend on frame |index|. The reason for this is that
- // WebP uses the previous frame for alpha blending, in ApplyPostProcessing().
- //
- // Before calling this, verify that frame |index| exists by checking that
- // |index| is smaller than |frame_buffer_cache_|.size().
- bool FrameStatusSufficientForSuccessors(size_t index) override {
- DCHECK(index < frame_buffer_cache_.size());
- return frame_buffer_cache_[index].GetStatus() == ImageFrame::kFrameComplete;
- }
-
- WebPIDecoder* decoder_;
- WebPDecBuffer decoder_buffer_;
- int format_flags_;
- bool frame_background_has_alpha_;
-
- void ReadColorProfile();
- bool UpdateDemuxer();
-
- // Set |frame_background_has_alpha_| based on this frame's characteristics.
- // Before calling this method, the caller must verify that the frame exists.
- void OnInitFrameBuffer(size_t frame_index) override;
-
- // When the blending method of this frame is BlendAtopPreviousFrame, the
- // previous frame's buffer is necessary to decode this frame in
- // ApplyPostProcessing, so we can't take over the data. Before calling this
- // method, the caller must verify that the frame exists.
- bool CanReusePreviousFrameBuffer(size_t frame_index) const override;
-
- void ApplyPostProcessing(size_t frame_index);
- void ClearFrameBuffer(size_t frame_index) override;
-
- WebPDemuxer* demux_;
- WebPDemuxState demux_state_;
- bool have_already_parsed_this_data_;
- int repetition_count_;
- int decoded_height_;
-
- typedef void (*AlphaBlendFunction)(ImageFrame&, ImageFrame&, int, int, int);
- AlphaBlendFunction blend_function_;
-
- void Clear();
- void ClearDecoder();
-
- // FIXME: Update libwebp's API so it does not require copying the data on each
- // update.
- sk_sp<SkData> consolidated_data_;
-};
-
-} // namespace blink
-
-#endif

Powered by Google App Engine
This is Rietveld 408576698