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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.h

Issue 2766263002: Refactor PNGImageDecoder's call to setSize (Closed)
Patch Set: Single return statement Created 3 years, 9 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, 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 26 matching lines...) Expand all
37 37
38 public: 38 public:
39 PNGImageDecoder(AlphaOption, 39 PNGImageDecoder(AlphaOption,
40 const ColorBehavior&, 40 const ColorBehavior&,
41 size_t maxDecodedBytes, 41 size_t maxDecodedBytes,
42 size_t offset = 0); 42 size_t offset = 0);
43 ~PNGImageDecoder() override; 43 ~PNGImageDecoder() override;
44 44
45 // ImageDecoder: 45 // ImageDecoder:
46 String filenameExtension() const override { return "png"; } 46 String filenameExtension() const override { return "png"; }
47 bool setSize(unsigned, unsigned) override;
47 int repetitionCount() const override; 48 int repetitionCount() const override;
48 bool frameIsCompleteAtIndex(size_t) const override; 49 bool frameIsCompleteAtIndex(size_t) const override;
49 float frameDurationAtIndex(size_t) const override; 50 float frameDurationAtIndex(size_t) const override;
50 bool setFailed() override; 51 bool setFailed() override;
51 52
52 // Callbacks from libpng 53 // Callbacks from libpng
53 void headerAvailable(); 54 void headerAvailable();
54 void rowAvailable(unsigned char* row, unsigned rowIndex, int); 55 void rowAvailable(unsigned char* row, unsigned rowIndex, int);
55 void frameComplete(); 56 void frameComplete();
56 57
58 void setColorSpace();
57 void setRepetitionCount(int); 59 void setRepetitionCount(int);
58 60
59 private: 61 private:
60 using ParseQuery = PNGImageReader::ParseQuery; 62 using ParseQuery = PNGImageReader::ParseQuery;
61 63
62 // ImageDecoder: 64 // ImageDecoder:
63 void decodeSize() override { parse(ParseQuery::Size); } 65 void decodeSize() override { parse(ParseQuery::Size); }
64 void decode(size_t) override; 66 void decode(size_t) override;
65 void parse(ParseQuery); 67 void parse(ParseQuery);
66 size_t decodeFrameCount() override; 68 size_t decodeFrameCount() override;
67 void initializeNewFrame(size_t) override; 69 void initializeNewFrame(size_t) override;
68 void clearFrameBuffer(size_t) override; 70 void clearFrameBuffer(size_t) override;
69 bool canReusePreviousFrameBuffer(size_t) const override; 71 bool canReusePreviousFrameBuffer(size_t) const override;
70 72
71 std::unique_ptr<PNGImageReader> m_reader; 73 std::unique_ptr<PNGImageReader> m_reader;
72 const unsigned m_offset; 74 const unsigned m_offset;
73 size_t m_currentFrame; 75 size_t m_currentFrame;
74 int m_repetitionCount; 76 int m_repetitionCount;
75 bool m_hasAlphaChannel; 77 bool m_hasAlphaChannel;
76 bool m_currentBufferSawAlpha; 78 bool m_currentBufferSawAlpha;
77 }; 79 };
78 80
79 } // namespace blink 81 } // namespace blink
80 82
81 #endif 83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698