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

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: 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/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 b5d1490fa484e330e0b3ce1084a75bf873d456e1..9e32d5d402b3cda20813e2d68a3d0c142494931e 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/Allocator.h"
#include "wtf/Assertions.h"
#include "wtf/PassRefPtr.h"
@@ -68,7 +69,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();
@@ -92,6 +98,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
@@ -112,6 +119,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
@@ -148,6 +156,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