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

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

Issue 2426723005: Use SkColorSpaceXform to handle color conversions in decoders (Closed)
Patch Set: Remove ifdefs - fixes blink_platform_unittests 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..420a5a73e1add9e81eee9b441cf825282e69cf37 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -28,6 +28,7 @@
#define ImageDecoder_h
#include "SkColorPriv.h"
+#include "SkColorSpaceXform.h"
#include "platform/PlatformExport.h"
#include "platform/SharedBuffer.h"
#include "platform/graphics/ImageOrientation.h"
@@ -42,23 +43,17 @@
#include "wtf/text/WTFString.h"
#include <memory>
-#if USE(QCMSLIB)
-#include "qcms.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 SK_B32_SHIFT
+inline SkColorSpaceXform::ColorFormat xformColorFormat() {
+ return SkColorSpaceXform::kRGBA_8888_ColorFormat;
+}
+#else
+inline SkColorSpaceXform::ColorFormat xformColorFormat() {
+ return SkColorSpaceXform::kBGRA_8888_ColorFormat;
+}
+#endif
// ImagePlanes can be used to decode color components into provided buffers
// instead of using an ImageFrame.
@@ -224,18 +219,14 @@ 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);
+
+ // Transformation from encoded color space to target color space.
+ SkColorSpaceXform* colorTransform() {
return m_sourceToOutputDeviceColorTransform.get();
}
-#endif
// Sets the "decode failure" flag. For caller convenience (since so
// many callers want to return false after calling this), returns false
@@ -361,9 +352,7 @@ class PLATFORM_EXPORT ImageDecoder {
bool m_hasColorProfile = false;
ImageFrame::ICCProfile m_colorProfile;
-#if USE(QCMSLIB)
- QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform;
-#endif
+ std::unique_ptr<SkColorSpaceXform> m_sourceToOutputDeviceColorTransform;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698