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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageFrame.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: cleanup. tableChanged was wrong - do proper check. Created 5 years, 1 month 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/image-decoders/ImageFrame.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
index fb7425755bd77887066531b171c6c8dc21c5b2d8..e23bf7ab6b927e76447965c17ee3356659312dde 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
@@ -30,6 +30,7 @@
#include "platform/PlatformExport.h"
#include "platform/geometry/IntRect.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkColorPriv.h"
#include "wtf/Assertions.h"
#include "wtf/PassRefPtr.h"
@@ -66,7 +67,12 @@ public:
// overwrite the corresponding pixels).
BlendAtopBgcolor,
};
+ enum ColorType {
+ N32 = kN32_SkColorType,
+ Index8 = kIndex_8_SkColorType
+ };
typedef uint32_t PixelData;
+ typedef uint8_t PixelData8;
ImageFrame();
@@ -90,6 +96,7 @@ public:
// pixel data, so that modifications in one frame are not reflected in
// the other. Returns whether the copy succeeded.
bool copyBitmapData(const ImageFrame&);
+ bool copyBitmapData(const ImageFrame&, ImageFrame::ColorType);
// Copies the pixel data at [(startX, startY), (endX, startY)) to the
// same X-coordinates on each subsequent row up to but not including
@@ -110,6 +117,7 @@ public:
// are written. Must only be called once. Returns whether allocation
// succeeded.
bool setSize(int newWidth, int newHeight);
+ bool setSizeIndex8(int newWidth, int newHeight, const Vector<blink::ImageFrame::PixelData>& colorMap, size_t indexOfTransparent = kNotFound);
// Returns a caller-owned pointer to the underlying native image data.
// (Actual use: This pointer will be owned by BitmapImage and freed in
@@ -146,6 +154,11 @@ public:
return m_bitmap.getAddr32(x, y);
}
+ inline PixelData8* getAddr8(int x, int y)
+ {
+ return m_bitmap.getAddr8(x, y);
+ }
+
inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
{
setRGBA(getAddr(x, y), r, g, b, a);

Powered by Google App Engine
This is Rietveld 408576698