summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-21 15:59:13 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-21 22:10:47 +0000
commit7dd72a3f39c09a7fdc34558061831620bc149420 (patch)
tree35deeb8f5d8a63c7644ad133135c06bba65a923c /core/fxcrt
parent72a39ceb264156446f91fcdc6522ea0c05e4eaae (diff)
downloadpdfium-7dd72a3f39c09a7fdc34558061831620bc149420.tar.xz
Move colorspace specific code to colorspace class
This Cl moves the Matrix and Vector code which is only used by the colorspace code into the colorspace cpp file. Change-Id: Ie37bcee0978278a56d345e63704494b5b67e5b24 Reviewed-on: https://pdfium-review.googlesource.com/3137 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_basic.h61
-rw-r--r--core/fxcrt/fx_basic_util.cpp26
2 files changed, 2 insertions, 85 deletions
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index ee630e100d..076766a0a2 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -338,18 +338,12 @@ class CFX_BitStream {
public:
void Init(const uint8_t* pData, uint32_t dwSize);
- uint32_t GetBits(uint32_t nBits);
-
void ByteAlign();
-
- bool IsEOF() { return m_BitPos >= m_BitSize; }
-
+ bool IsEOF() const { return m_BitPos >= m_BitSize; }
+ uint32_t GetBits(uint32_t nBits);
void SkipBits(uint32_t nBits) { m_BitPos += nBits; }
-
void Rewind() { m_BitPos = 0; }
-
uint32_t GetPos() const { return m_BitPos; }
-
uint32_t BitsRemaining() const {
return m_BitSize >= m_BitPos ? m_BitSize - m_BitPos : 0;
}
@@ -378,57 +372,6 @@ class CFX_AutoRestorer {
const T m_OldValue;
};
-class CFX_Vector_3by1 {
- public:
- CFX_Vector_3by1() : a(0.0f), b(0.0f), c(0.0f) {}
-
- CFX_Vector_3by1(float a1, float b1, float c1) : a(a1), b(b1), c(c1) {}
-
- float a;
- float b;
- float c;
-};
-class CFX_Matrix_3by3 {
- public:
- CFX_Matrix_3by3()
- : a(0.0f),
- b(0.0f),
- c(0.0f),
- d(0.0f),
- e(0.0f),
- f(0.0f),
- g(0.0f),
- h(0.0f),
- i(0.0f) {}
-
- CFX_Matrix_3by3(float a1,
- float b1,
- float c1,
- float d1,
- float e1,
- float f1,
- float g1,
- float h1,
- float i1)
- : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1), g(g1), h(h1), i(i1) {}
-
- CFX_Matrix_3by3 Inverse();
-
- CFX_Matrix_3by3 Multiply(const CFX_Matrix_3by3& m);
-
- CFX_Vector_3by1 TransformVector(const CFX_Vector_3by1& v);
-
- float a;
- float b;
- float c;
- float d;
- float e;
- float f;
- float g;
- float h;
- float i;
-};
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits);
#endif // CORE_FXCRT_FX_BASIC_H_
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index b3c5829fc9..19e5696c86 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -205,32 +205,6 @@ wchar_t FX_GetFolderSeparator() {
#endif
}
-CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() {
- 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();
-
- 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);
-}
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits) {
ASSERT(0 < nbits && nbits <= 32);
const uint8_t* dataPtr = &pData[bitpos / 8];