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

Unified Diff: Source/platform/graphics/Color.cpp

Issue 134733016: Add support for converting Colors to linear RGB; Fix relevant filters (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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: Source/platform/graphics/Color.cpp
diff --git a/Source/platform/graphics/Color.cpp b/Source/platform/graphics/Color.cpp
index 938e12cced410985b6be9c820ac5fb701b47fa33..92b0d44a612f4e8c560b39abab45928208fc3355 100644
--- a/Source/platform/graphics/Color.cpp
+++ b/Source/platform/graphics/Color.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "platform/graphics/Color.h"
+#include "platform/graphics/ColorSpace.h"
#include "wtf/Assertions.h"
#include "wtf/DecimalNumber.h"
#include "wtf/HexNumber.h"
@@ -332,6 +333,12 @@ Color Color::combineWithAlpha(float otherAlpha) const
return colorWithOverrideAlpha(rgb(), (alpha() / 255.f) * otherAlpha);
}
+Color Color::convertToLinear() const
+{
+ const Vector<uint8_t>& lookUpTable = getLinearRgbLUT();
+ return Color(lookUpTable[red()], lookUpTable[green()], lookUpTable[blue()], alpha());
+}
+
static int blendComponent(int c, int a)
{
// We use white.

Powered by Google App Engine
This is Rietveld 408576698