diff options
author | scroggo <scroggo@chromium.org> | 2016-10-24 12:28:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-24 12:28:30 -0700 |
commit | 3d3a65c488162ef1db0b35adf3235d012b04c88d (patch) | |
tree | ce515502471340a16ba030b18677ae846356125b | |
parent | d0a3b06ce2155b5455c8827415e4505c328b9003 (diff) |
Rename GIFImageReader to SkGifImageReader
The former could violate One Definition Rule in Google3, since other
projects that are based on Chrome/webkit also have GIFImageReader.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2445653004
Review-Url: https://codereview.chromium.org/2445653004
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | gyp/codec.gyp | 2 | ||||
-rw-r--r-- | src/codec/SkGifCodec.cpp | 14 | ||||
-rw-r--r-- | src/codec/SkGifCodec.h | 28 | ||||
-rw-r--r-- | third_party/gif/SkGifImageReader.cpp (renamed from third_party/gif/GIFImageReader.cpp) | 16 | ||||
-rw-r--r-- | third_party/gif/SkGifImageReader.h (renamed from third_party/gif/GIFImageReader.h) | 10 |
6 files changed, 36 insertions, 36 deletions
@@ -541,7 +541,7 @@ component("skia") { "src/svg/SkSVGDevice.cpp", "src/utils/mac/SkStream_mac.cpp", "third_party/etc1/etc1.cpp", - "third_party/gif/GIFImageReader.cpp", + "third_party/gif/SkGifImageReader.cpp", "third_party/ktx/ktx.cpp", ] diff --git a/gyp/codec.gyp b/gyp/codec.gyp index e9780fe746..51ee97f750 100644 --- a/gyp/codec.gyp +++ b/gyp/codec.gyp @@ -55,7 +55,7 @@ '../src/codec/SkCodecImageGenerator.cpp', '../src/ports/SkImageGenerator_skia.cpp', - '../third_party/gif/GIFImageReader.cpp', + '../third_party/gif/SkGifImageReader.cpp', ], 'direct_dependent_settings': { 'include_dirs': [ diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp index 3f37bc35cc..1c250fcccb 100644 --- a/src/codec/SkGifCodec.cpp +++ b/src/codec/SkGifCodec.cpp @@ -72,8 +72,8 @@ static SkCodec::Result gif_error(const char* msg, SkCodec::Result result = SkCod * Reads enough of the stream to determine the image format */ SkCodec* SkGifCodec::NewFromStream(SkStream* stream) { - std::unique_ptr<GIFImageReader> reader(new GIFImageReader(stream)); - if (!reader->parse(GIFImageReader::GIFSizeQuery)) { + std::unique_ptr<SkGifImageReader> reader(new SkGifImageReader(stream)); + if (!reader->parse(SkGifImageReader::GIFSizeQuery)) { // Not enough data to determine the size. return nullptr; } @@ -110,7 +110,7 @@ bool SkGifCodec::onRewind() { } SkGifCodec::SkGifCodec(const SkEncodedInfo& encodedInfo, const SkImageInfo& imageInfo, - GIFImageReader* reader) + SkGifImageReader* reader) : INHERITED(encodedInfo, imageInfo, nullptr) , fReader(reader) , fTmpBuffer(nullptr) @@ -127,7 +127,7 @@ SkGifCodec::SkGifCodec(const SkEncodedInfo& encodedInfo, const SkImageInfo& imag } std::vector<SkCodec::FrameInfo> SkGifCodec::onGetFrameInfo() { - fReader->parse(GIFImageReader::GIFFrameCountQuery); + fReader->parse(SkGifImageReader::GIFFrameCountQuery); const size_t size = fReader->imagesCount(); std::vector<FrameInfo> result(size); for (size_t i = 0; i < size; i++) { @@ -184,7 +184,7 @@ SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo kInvalidConversion); } - fReader->parse((GIFImageReader::GIFParseQuery) frameIndex); + fReader->parse((SkGifImageReader::GIFParseQuery) frameIndex); if (frameIndex >= fReader->imagesCount()) { return gif_error("frame index out of range!\n", kIncompleteInput); @@ -269,7 +269,7 @@ SkCodec::Result SkGifCodec::onIncrementalDecode(int* rowsDecoded) { // It is possible the client has appended more data. Parse, if needed. const auto& options = this->options(); const size_t frameIndex = options.fFrameIndex; - fReader->parse((GIFImageReader::GIFParseQuery) frameIndex); + fReader->parse((SkGifImageReader::GIFParseQuery) frameIndex); const bool firstCallToIncrementalDecode = fFirstCallToIncrementalDecode; fFirstCallToIncrementalDecode = false; @@ -357,7 +357,7 @@ SkCodec::Result SkGifCodec::decodeFrame(bool firstAttempt, const Options& opts, } } - // Note: there is a difference between the following call to GIFImageReader::decode + // Note: there is a difference between the following call to SkGifImageReader::decode // returning false and leaving frameDecoded false: // - If the method returns false, there was an error in the stream. We still treat this as // incomplete, since we have already decoded some rows. diff --git a/src/codec/SkGifCodec.h b/src/codec/SkGifCodec.h index 544ba13695..b5f8f7ce0c 100644 --- a/src/codec/SkGifCodec.h +++ b/src/codec/SkGifCodec.h @@ -12,7 +12,7 @@ #include "SkImageInfo.h" #include "SkSwizzler.h" -#include "GIFImageReader.h" +#include "SkGifImageReader.h" /* * @@ -30,7 +30,7 @@ public: */ static SkCodec* NewFromStream(SkStream*); - // Callback for GIFImageReader when a row is available. + // Callback for SkGifImageReader when a row is available. bool haveDecodedRow(size_t frameIndex, const unsigned char* rowBegin, size_t rowNumber, unsigned repeatCount, bool writeTransparentPixels); protected: @@ -127,31 +127,31 @@ private: /* * Creates an instance of the decoder * Called only by NewFromStream - * Takes ownership of the GIFImageReader + * Takes ownership of the SkGifImageReader */ - SkGifCodec(const SkEncodedInfo&, const SkImageInfo&, GIFImageReader*); + SkGifCodec(const SkEncodedInfo&, const SkImageInfo&, SkGifImageReader*); - std::unique_ptr<GIFImageReader> fReader; - std::unique_ptr<uint8_t[]> fTmpBuffer; - std::unique_ptr<SkSwizzler> fSwizzler; - sk_sp<SkColorTable> fCurrColorTable; + std::unique_ptr<SkGifImageReader> fReader; + std::unique_ptr<uint8_t[]> fTmpBuffer; + std::unique_ptr<SkSwizzler> fSwizzler; + sk_sp<SkColorTable> fCurrColorTable; // We may create a dummy table if there is not a Map in the input data. In // that case, we set this value to false, and we can skip a lot of decoding // work (which would not be meaningful anyway). We create a "fake"/"dummy" // one in that case, so the client and the swizzler have something to draw. - bool fCurrColorTableIsReal; + bool fCurrColorTableIsReal; // Whether the background was filled. - bool fFilledBackground; + bool fFilledBackground; // True on the first call to onIncrementalDecode. This value is passed to // decodeFrame. - bool fFirstCallToIncrementalDecode; + bool fFirstCallToIncrementalDecode; - void* fDst; - size_t fDstRowBytes; + void* fDst; + size_t fDstRowBytes; // Updated inside haveDecodedRow when rows are decoded, unless we filled // the background, in which case it is set once and left alone. - int fRowsDecoded; + int fRowsDecoded; typedef SkCodec INHERITED; }; diff --git a/third_party/gif/GIFImageReader.cpp b/third_party/gif/SkGifImageReader.cpp index 859b45f7c4..efc273dd35 100644 --- a/third_party/gif/GIFImageReader.cpp +++ b/third_party/gif/SkGifImageReader.cpp @@ -72,7 +72,7 @@ or revised. This service is offered free of charge; please provide us with your mailing address. */ -#include "GIFImageReader.h" +#include "SkGifImageReader.h" #include "SkColorPriv.h" #include "SkGifCodec.h" @@ -85,7 +85,7 @@ mailing address. // Note, the hold will never need to be bigger than 256 bytes to gather up in the hold, // as each GIF block (except colormaps) can never be bigger than 256 bytes. // Colormaps are directly copied in the resp. global_colormap or dynamically allocated local_colormap. -// So a fixed buffer in GIFImageReader is good enough. +// So a fixed buffer in SkGifImageReader is good enough. // This buffer is only needed to copy left-over data from one GifWrite call to the next #define GETN(n, s) \ do { \ @@ -198,7 +198,7 @@ bool GIFLZWContext::outputRow(const unsigned char* rowBegin) // Perform Lempel-Ziv-Welch decoding. // Returns true if decoding was successful. In this case the block will have been completely consumed and/or rowsRemaining will be 0. -// Otherwise, decoding failed; returns false in this case, which will always cause the GIFImageReader to set the "decode failed" flag. +// Otherwise, decoding failed; returns false in this case, which will always cause the SkGifImageReader to set the "decode failed" flag. bool GIFLZWContext::doLZW(const unsigned char* block, size_t bytesInBlock) { const size_t width = m_frameContext->width(); @@ -340,7 +340,7 @@ sk_sp<SkColorTable> GIFColorMap::buildTable(SkColorType colorType, size_t transp return m_table; } -sk_sp<SkColorTable> GIFImageReader::getColorTable(SkColorType colorType, size_t index) const { +sk_sp<SkColorTable> SkGifImageReader::getColorTable(SkColorType colorType, size_t index) const { if (index >= m_frames.size()) { return nullptr; } @@ -357,7 +357,7 @@ sk_sp<SkColorTable> GIFImageReader::getColorTable(SkColorType colorType, size_t } // Perform decoding for this frame. frameComplete will be true if the entire frame is decoded. -// Returns false if a decoding error occurred. This is a fatal error and causes the GIFImageReader to set the "decode failed" flag. +// Returns false if a decoding error occurred. This is a fatal error and causes the SkGifImageReader to set the "decode failed" flag. // Otherwise, either not enough data is available to decode further than before, or the new data has been decoded successfully; returns true in this case. bool GIFFrameContext::decode(SkGifCodec* client, bool* frameComplete) { @@ -397,7 +397,7 @@ bool GIFFrameContext::decode(SkGifCodec* client, bool* frameComplete) // Decode a frame. // This method uses GIFFrameContext:decode() to decode the frame; decoding error is reported to client as a critical failure. // Return true if decoding has progressed. Return false if an error has occurred. -bool GIFImageReader::decode(size_t frameIndex, bool* frameComplete) +bool SkGifImageReader::decode(size_t frameIndex, bool* frameComplete) { GIFFrameContext* currentFrame = m_frames[frameIndex].get(); @@ -407,7 +407,7 @@ bool GIFImageReader::decode(size_t frameIndex, bool* frameComplete) // Parse incoming GIF data stream into internal data structures. // Return true if parsing has progressed or there is not enough data. // Return false if a fatal error is encountered. -bool GIFImageReader::parse(GIFImageReader::GIFParseQuery query) +bool SkGifImageReader::parse(SkGifImageReader::GIFParseQuery query) { if (m_parseCompleted) { return true; @@ -849,7 +849,7 @@ bool GIFImageReader::parse(GIFImageReader::GIFParseQuery query) return true; } -void GIFImageReader::addFrameIfNecessary() +void SkGifImageReader::addFrameIfNecessary() { if (m_frames.empty() || m_frames.back()->isComplete()) { const size_t i = m_frames.size(); diff --git a/third_party/gif/GIFImageReader.h b/third_party/gif/SkGifImageReader.h index 307b8c4092..5dc0e4f6dd 100644 --- a/third_party/gif/GIFImageReader.h +++ b/third_party/gif/SkGifImageReader.h @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef GIFImageReader_h -#define GIFImageReader_h +#ifndef SkGifImageReader_h +#define SkGifImageReader_h // Define ourselves as the clientPtr. Mozilla just hacked their C++ callback class into this old C decoder, // so we will too. @@ -275,10 +275,10 @@ private: bool m_isDataSizeDefined; }; -class GIFImageReader final : public SkNoncopyable { +class SkGifImageReader final : public SkNoncopyable { public: // This takes ownership of stream. - GIFImageReader(SkStream* stream) + SkGifImageReader(SkStream* stream) : m_client(nullptr) , m_state(GIFType) , m_bytesToConsume(6) // Number of bytes for GIF type, either "GIF87a" or "GIF89a". @@ -293,7 +293,7 @@ public: { } - ~GIFImageReader() + ~SkGifImageReader() { } |