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: Source/platform/image-decoders/png/PNGImageDecoder.h

Issue 1316203008: Never consolidate data in ICO decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@FastSharedBuffer
Patch Set: Respond to pkasting@'s comments in patch set 2 Created 5 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) 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 19 matching lines...) Expand all
30 #include "wtf/Noncopyable.h" 30 #include "wtf/Noncopyable.h"
31 #include "wtf/OwnPtr.h" 31 #include "wtf/OwnPtr.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class PNGImageReader; 35 class PNGImageReader;
36 36
37 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder { 37 class PLATFORM_EXPORT PNGImageDecoder : public ImageDecoder {
38 WTF_MAKE_NONCOPYABLE(PNGImageDecoder); 38 WTF_MAKE_NONCOPYABLE(PNGImageDecoder);
39 public: 39 public:
40 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes); 40 PNGImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes, unsigned offset = 0);
41 ~PNGImageDecoder() override; 41 ~PNGImageDecoder() override;
42 42
43 // ImageDecoder: 43 // ImageDecoder:
44 String filenameExtension() const override { return "png"; } 44 String filenameExtension() const override { return "png"; }
45 bool hasColorProfile() const override { return m_hasColorProfile; } 45 bool hasColorProfile() const override { return m_hasColorProfile; }
46 46
47 // Callbacks from libpng 47 // Callbacks from libpng
48 void headerAvailable(); 48 void headerAvailable();
49 void rowAvailable(unsigned char* row, unsigned rowIndex, int); 49 void rowAvailable(unsigned char* row, unsigned rowIndex, int);
50 void complete(); 50 void complete();
51 51
52 private: 52 private:
53 // ImageDecoder: 53 // ImageDecoder:
54 void decodeSize() override { decode(true); } 54 void decodeSize() override { decode(true); }
55 void decode(size_t) override { decode(false); } 55 void decode(size_t) override { decode(false); }
56 56
57 // Decodes the image. If |onlySize| is true, stops decoding after 57 // Decodes the image. If |onlySize| is true, stops decoding after
58 // calculating the image size. If decoding fails but there is no more 58 // calculating the image size. If decoding fails but there is no more
59 // data coming, sets the "decode failure" flag. 59 // data coming, sets the "decode failure" flag.
60 void decode(bool onlySize); 60 void decode(bool onlySize);
61 61
62 OwnPtr<PNGImageReader> m_reader; 62 OwnPtr<PNGImageReader> m_reader;
63 bool m_hasColorProfile; 63 bool m_hasColorProfile;
64 const unsigned m_offset;
64 }; 65 };
65 66
66 } // namespace blink 67 } // namespace blink
67 68
68 #endif 69 #endif
OLDNEW
« no previous file with comments | « Source/platform/image-decoders/ico/ICOImageDecoder.cpp ('k') | Source/platform/image-decoders/png/PNGImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698