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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 2426723005: Use SkColorSpaceXform to handle color conversions in decoders (Closed)
Patch Set: Rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
index ced7fa20be5d37b52973e14a9092060ed589e8f5..a3d9cd2426df51296997e2106f15777cc03e488e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -42,23 +42,23 @@
#include "wtf/text/WTFString.h"
#include <memory>
-#if USE(QCMSLIB)
-#include "qcms.h"
+#if USE(SKCOLORXFORM)
+#include "SkColorSpaceXform.h"
#endif
namespace blink {
-#if USE(QCMSLIB)
-struct QCMSTransformDeleter {
- void operator()(qcms_transform* transform) {
- if (transform)
- qcms_transform_release(transform);
- }
-};
-
-using QCMSTransformUniquePtr =
- std::unique_ptr<qcms_transform, QCMSTransformDeleter>;
-#endif // USE(QCMSLIB)
+#if USE(SKCOLORXFORM)
+#if SK_B32_SHIFT
+inline SkColorSpaceXform::ColorFormat xformColorFormat() {
+ return SkColorSpaceXform::kRGBA_8888_ColorFormat;
+}
+#else
+inline SkColorSpaceXform::ColorFormat xformColorFormat() {
+ return SkColorSpaceXform::kBGRA_8888_ColorFormat;
+}
+#endif
+#endif // USE(SKCOLORXFORM)
// ImagePlanes can be used to decode color components into provided buffers
// instead of using an ImageFrame.
@@ -224,15 +224,13 @@ class PLATFORM_EXPORT ImageDecoder {
// embedded color profile, and is independent of whether or not that
// profile's transform has been baked into the pixel values.
bool hasColorProfile() const { return m_hasColorProfile; }
- void setColorProfileAndComputeTransform(const char* iccData,
- unsigned iccLength,
- bool hasAlpha,
- bool useSRGB);
-
-#if USE(QCMSLIB)
- // In contrast with hasColorProfile, this refers to the transform that has
- // been baked into the pixels.
- qcms_transform* colorTransform() {
+ void setColorSpaceAndComputeTransform(const char* iccData,
+ unsigned iccLength,
+ bool useSRGB);
+
+#if USE(SKCOLORXFORM)
+ // Transformation from encoded color space to target color space.
+ SkColorSpaceXform* colorTransform() {
return m_sourceToOutputDeviceColorTransform.get();
}
#endif
@@ -361,8 +359,8 @@ class PLATFORM_EXPORT ImageDecoder {
bool m_hasColorProfile = false;
ImageFrame::ICCProfile m_colorProfile;
-#if USE(QCMSLIB)
- QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform;
+#if USE(SKCOLORXFORM)
+ std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform;
#endif
};

Powered by Google App Engine
This is Rietveld 408576698