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

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

Issue 2516593003: Pull up clearCacheExceptFrame to ImageDecoder. (Closed)
Patch Set: Add todo for changing MockImageDecoder Created 4 years 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 * 7 *
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public: 43 public:
44 WEBPImageDecoder(AlphaOption, ColorSpaceOption, size_t maxDecodedBytes); 44 WEBPImageDecoder(AlphaOption, ColorSpaceOption, size_t maxDecodedBytes);
45 ~WEBPImageDecoder() override; 45 ~WEBPImageDecoder() override;
46 46
47 // ImageDecoder: 47 // ImageDecoder:
48 String filenameExtension() const override { return "webp"; } 48 String filenameExtension() const override { return "webp"; }
49 void onSetData(SegmentReader* data) override; 49 void onSetData(SegmentReader* data) override;
50 int repetitionCount() const override; 50 int repetitionCount() const override;
51 bool frameIsCompleteAtIndex(size_t) const override; 51 bool frameIsCompleteAtIndex(size_t) const override;
52 float frameDurationAtIndex(size_t) const override; 52 float frameDurationAtIndex(size_t) const override;
53 size_t clearCacheExceptFrame(size_t) override;
54 53
55 private: 54 private:
56 // ImageDecoder: 55 // ImageDecoder:
57 virtual void decodeSize() { updateDemuxer(); } 56 virtual void decodeSize() { updateDemuxer(); }
58 size_t decodeFrameCount() override; 57 size_t decodeFrameCount() override;
59 void initializeNewFrame(size_t) override; 58 void initializeNewFrame(size_t) override;
60 void decode(size_t) override; 59 void decode(size_t) override;
61 60
62 bool decodeSingleFrame(const uint8_t* dataBytes, 61 bool decodeSingleFrame(const uint8_t* dataBytes,
63 size_t dataSize, 62 size_t dataSize,
64 size_t frameIndex); 63 size_t frameIndex);
65 64
65 // For WebP images, the frame status needs to be FrameComplete to decode
66 // subsequent frames that depend on frame |index|. The reason for this is that
67 // WebP uses the previous frame for alpha blending, in applyPostProcessing().
68 //
69 // Before calling this, verify that frame |index| exists by checking that
70 // |index| is smaller than |m_frameBufferCache|.size().
71 bool frameStatusSufficientForSuccessors(size_t index) override {
72 DCHECK(index < m_frameBufferCache.size());
73 return m_frameBufferCache[index].getStatus() == ImageFrame::FrameComplete;
74 }
75
66 WebPIDecoder* m_decoder; 76 WebPIDecoder* m_decoder;
67 WebPDecBuffer m_decoderBuffer; 77 WebPDecBuffer m_decoderBuffer;
68 int m_formatFlags; 78 int m_formatFlags;
69 bool m_frameBackgroundHasAlpha; 79 bool m_frameBackgroundHasAlpha;
70 80
71 void readColorProfile(); 81 void readColorProfile();
72 bool updateDemuxer(); 82 bool updateDemuxer();
73 83
74 // Set |m_frameBackgroundHasAlpha| based on this frame's characteristics. 84 // Set |m_frameBackgroundHasAlpha| based on this frame's characteristics.
75 // Before calling this method, the caller must verify that the frame exists. 85 // Before calling this method, the caller must verify that the frame exists.
(...skipping 21 matching lines...) Expand all
97 void clearDecoder(); 107 void clearDecoder();
98 108
99 // FIXME: Update libwebp's API so it does not require copying the data on each 109 // FIXME: Update libwebp's API so it does not require copying the data on each
100 // update. 110 // update.
101 sk_sp<SkData> m_consolidatedData; 111 sk_sp<SkData> m_consolidatedData;
102 }; 112 };
103 113
104 } // namespace blink 114 } // namespace blink
105 115
106 #endif 116 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698