summaryrefslogtreecommitdiff
path: root/core/src/fxcrt
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-07-24 17:50:59 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-07-24 17:50:59 -0700
commite7e6ca4355209af3a3a8142519f12cebe36889b1 (patch)
tree44444dcba68a0d22f6711ce0392b7c1ca7bdb77e /core/src/fxcrt
parent3414a6447fcd7a8338beb8d641c8f50c2e60a2b0 (diff)
downloadpdfium-e7e6ca4355209af3a3a8142519f12cebe36889b1.tar.xz
CalRGB color correction
BUG=pdfium:19 R=thestig@chromium.org Review URL: https://codereview.chromium.org/403163002
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r--core/src/fxcrt/fx_basic_util.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index dc5eea7821..5a40c2b4be 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -442,3 +442,46 @@ FX_WCHAR FX_GetFolderSeparator()
return '/';
#endif
}
+
+CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse()
+{
+ FX_FLOAT det = a*(e*i - f*h) - b*(i*d - f*g) + c*(d*h - e*g);
+ if (FXSYS_fabs(det) < 0.0000001)
+ return CFX_Matrix_3by3();
+ else
+ return CFX_Matrix_3by3(
+ (e*i - f*h) / det,
+ -(b*i - c*h) / det,
+ (b*f - c*e) / det,
+ -(d*i - f*g) / det,
+ (a*i - c*g) / det,
+ -(a*f - c*d) / det,
+ (d*h - e*g) / det,
+ -(a*h - b*g) / det,
+ (a*e - b*d) / det
+ );
+}
+
+CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3 &m)
+{
+ return CFX_Matrix_3by3(
+ a*m.a + b*m.d + c*m.g,
+ a*m.b + b*m.e + c*m.h,
+ a*m.c + b*m.f + c*m.i,
+ d*m.a + e*m.d + f*m.g,
+ d*m.b + e*m.e + f*m.h,
+ d*m.c + e*m.f + f*m.i,
+ g*m.a + h*m.d + i*m.g,
+ g*m.b + h*m.e + i*m.h,
+ g*m.c + h*m.f + i*m.i
+ );
+}
+
+CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v)
+{
+ return CFX_Vector_3by1(
+ a * v.a + b * v.b + c * v.c,
+ d * v.a + e * v.b + f * v.c,
+ g * v.a + h * v.b + i * v.c
+ );
+}