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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h

Issue 1460523002: GIF decoding to Index8, unit tests and misusing unit test as benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skia:onGetColorType related implementation. Fix part of Leon's review comments. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
diff --git a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
index 06664c71efcd8d4b562fa11ad75a1786e45a3593..66fdb61416a9fe3412755f1340c5e4ab915c3213 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
+++ b/third_party/WebKit/Source/platform/graphics/ImageFrameGenerator.h
@@ -71,7 +71,7 @@ public:
// into |pixels| with a stride of |rowBytes|.
//
// Returns true if decoding was successful.
- bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t rowBytes);
+ bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t rowBytes, SkPMColor ctable[] = nullptr, int* ctableCount = nullptr);
// Decodes YUV components directly into the provided memory planes.
bool decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes[3]);
@@ -90,6 +90,10 @@ public:
bool getYUVComponentSizes(SkISize componentSizes[3]);
+ // Specifies that there is decoder support, to optimize when to call canDecodeTo().
+ void setDecoderCanDecodeToIndex8(bool canIt) { m_decoderCanDecodeToIndex8 = canIt; }
+ bool canDecodeTo(size_t index, SkColorType outputType);
+
private:
class ExternalMemoryAllocator;
friend class ImageFrameGeneratorTest;
@@ -100,11 +104,11 @@ private:
void setHasAlpha(size_t index, bool hasAlpha);
// These methods are called while m_decodeMutex is locked.
- SkBitmap tryToResumeDecode(const SkISize& scaledSize, size_t index);
+ SkBitmap tryToResumeDecode(const SkISize& scaledSize, size_t index, SkColorType outputColor);
// Use the given decoder to decode. If a decoder is not given then try to create one.
// Returns true if decoding was complete.
- bool decode(size_t index, ImageDecoder**, SkBitmap*);
+ bool decode(size_t index, ImageDecoder**, SkBitmap*, SkColorType);
SkISize m_fullSize;
ThreadSafeDataTransport m_data;
@@ -127,6 +131,7 @@ private:
#if COMPILER(MSVC)
friend struct ::WTF::OwnedPtrDeleter<ExternalMemoryAllocator>;
#endif
+ bool m_decoderCanDecodeToIndex8;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698