summaryrefslogtreecommitdiff
path: root/core/fxge/dib
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/dib')
-rw-r--r--core/fxge/dib/cfx_bitmapstorer.cpp1
-rw-r--r--core/fxge/dib/cfx_dibitmap.cpp1
-rw-r--r--core/fxge/dib/cfx_imagerenderer.cpp1
-rw-r--r--core/fxge/dib/cfx_imagestretcher.cpp2
-rw-r--r--core/fxge/dib/cfx_imagetransformer.cpp26
-rw-r--r--core/fxge/dib/cfx_imagetransformer.h1
-rw-r--r--core/fxge/dib/cstretchengine.cpp (renamed from core/fxge/dib/fx_dib_engine.cpp)35
-rw-r--r--core/fxge/dib/cstretchengine.h81
-rw-r--r--core/fxge/dib/cstretchengine_unittest.cpp (renamed from core/fxge/dib/fx_dib_engine_unittest.cpp)5
-rw-r--r--core/fxge/dib/dib_int.h116
-rw-r--r--core/fxge/dib/fx_dib_main.cpp1
11 files changed, 126 insertions, 144 deletions
diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp b/core/fxge/dib/cfx_bitmapstorer.cpp
index 4e1cb3bc38..1e09708098 100644
--- a/core/fxge/dib/cfx_bitmapstorer.cpp
+++ b/core/fxge/dib/cfx_bitmapstorer.cpp
@@ -8,7 +8,6 @@
#include <utility>
-#include "core/fxge/dib/dib_int.h"
#include "third_party/base/ptr_util.h"
CFX_BitmapStorer::CFX_BitmapStorer() {}
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 6292a67870..54977a6d23 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -13,7 +13,6 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/dib/cfx_scanlinecompositor.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/cfx_cliprgn.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp
index 89eb48f0cb..42c92eda06 100644
--- a/core/fxge/dib/cfx_imagerenderer.cpp
+++ b/core/fxge/dib/cfx_imagerenderer.cpp
@@ -10,7 +10,6 @@
#include "core/fxge/dib/cfx_imagestretcher.h"
#include "core/fxge/dib/cfx_imagetransformer.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/cfx_cliprgn.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp
index 94c107b4a3..f52a62d529 100644
--- a/core/fxge/dib/cfx_imagestretcher.cpp
+++ b/core/fxge/dib/cfx_imagestretcher.cpp
@@ -10,7 +10,7 @@
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_dibsource.h"
-#include "core/fxge/dib/dib_int.h"
+#include "core/fxge/dib/cstretchengine.h"
#include "core/fxge/fx_dib.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp
index 65f6bc8ec9..c5fb467ad8 100644
--- a/core/fxge/dib/cfx_imagetransformer.cpp
+++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -115,6 +115,32 @@ FXDIB_Format GetTransformedFormat(const CFX_RetainPtr<CFX_DIBSource>& pDrc) {
return format;
}
+class CPDF_FixedMatrix {
+ public:
+ CPDF_FixedMatrix(const CFX_Matrix& src, int bits) {
+ base = 1 << bits;
+ a = FXSYS_round(src.a * base);
+ b = FXSYS_round(src.b * base);
+ c = FXSYS_round(src.c * base);
+ d = FXSYS_round(src.d * base);
+ e = FXSYS_round(src.e * base);
+ f = FXSYS_round(src.f * base);
+ }
+
+ inline void Transform(int x, int y, int& x1, int& y1) {
+ x1 = (a * x + c * y + e + base / 2) / base;
+ y1 = (b * x + d * y + f + base / 2) / base;
+ }
+
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int base;
+};
+
class CFX_BilinearMatrix : public CPDF_FixedMatrix {
public:
CFX_BilinearMatrix(const CFX_Matrix& src, int bits)
diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h
index 1354c9099a..52aca9792e 100644
--- a/core/fxge/dib/cfx_imagetransformer.h
+++ b/core/fxge/dib/cfx_imagetransformer.h
@@ -14,7 +14,6 @@
#include "core/fxge/dib/cfx_bitmapstorer.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_dibsource.h"
-#include "core/fxge/dib/dib_int.h"
class CFX_ImageStretcher;
diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/cstretchengine.cpp
index 3ae0bf9031..0025331486 100644
--- a/core/fxge/dib/fx_dib_engine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -1,42 +1,37 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include <limits.h>
-
-#include <algorithm>
+#include "core/fxge/dib/cstretchengine.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/cfx_dibsource.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/dib/ifx_scanlinecomposer.h"
#include "core/fxge/fx_dib.h"
-#include "third_party/base/ptr_util.h"
-#include "third_party/base/stl_util.h"
-CWeightTable::CWeightTable()
+CStretchEngine::CWeightTable::CWeightTable()
: m_DestMin(0),
m_ItemSize(0),
m_pWeightTables(nullptr),
m_dwWeightTablesSize(0) {}
-CWeightTable::~CWeightTable() {
+CStretchEngine::CWeightTable::~CWeightTable() {
FX_Free(m_pWeightTables);
}
-size_t CWeightTable::GetPixelWeightSize() const {
+size_t CStretchEngine::CWeightTable::GetPixelWeightSize() const {
return m_ItemSize / sizeof(int) - 2;
}
-bool CWeightTable::Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max,
- int flags) {
+bool CStretchEngine::CWeightTable::Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max,
+ int flags) {
FX_Free(m_pWeightTables);
m_pWeightTables = nullptr;
m_dwWeightTablesSize = 0;
@@ -227,14 +222,14 @@ bool CWeightTable::Calc(int dest_len,
return true;
}
-PixelWeight* CWeightTable::GetPixelWeight(int pixel) const {
+PixelWeight* CStretchEngine::CWeightTable::GetPixelWeight(int pixel) const {
ASSERT(pixel >= m_DestMin);
return reinterpret_cast<PixelWeight*>(m_pWeightTables +
(pixel - m_DestMin) * m_ItemSize);
}
-int* CWeightTable::GetValueFromPixelWeight(PixelWeight* pWeight,
- int index) const {
+int* CStretchEngine::CWeightTable::GetValueFromPixelWeight(PixelWeight* pWeight,
+ int index) const {
if (index < pWeight->m_SrcStart)
return nullptr;
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
new file mode 100644
index 0000000000..0d9457fb9d
--- /dev/null
+++ b/core/fxge/dib/cstretchengine.h
@@ -0,0 +1,81 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_DIB_CSTRETCHENGINE_H_
+#define CORE_FXGE_DIB_CSTRETCHENGINE_H_
+
+#include "core/fxcrt/fx_coordinates.h"
+#include "core/fxge/fx_dib.h"
+
+class IFX_ScanlineComposer;
+
+class CStretchEngine {
+ public:
+ CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
+ FXDIB_Format dest_format,
+ int dest_width,
+ int dest_height,
+ const FX_RECT& clip_rect,
+ const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
+ int flags);
+ ~CStretchEngine();
+
+ bool Continue(IFX_Pause* pPause);
+
+ bool StartStretchHorz();
+ bool ContinueStretchHorz(IFX_Pause* pPause);
+ void StretchVert();
+
+ class CWeightTable {
+ public:
+ CWeightTable();
+ ~CWeightTable();
+
+ bool Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max,
+ int flags);
+ PixelWeight* GetPixelWeight(int pixel) const;
+ int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
+ size_t GetPixelWeightSize() const;
+
+ private:
+ int m_DestMin;
+ int m_ItemSize;
+ uint8_t* m_pWeightTables;
+ size_t m_dwWeightTablesSize;
+ };
+
+ FXDIB_Format m_DestFormat;
+ int m_DestBpp;
+ int m_SrcBpp;
+ int m_bHasAlpha;
+ IFX_ScanlineComposer* m_pDestBitmap;
+ int m_DestWidth, m_DestHeight;
+ FX_RECT m_DestClip;
+ uint8_t* m_pDestScanline;
+ uint8_t* m_pDestMaskScanline;
+ FX_RECT m_SrcClip;
+ CFX_RetainPtr<CFX_DIBSource> m_pSource;
+ uint32_t* m_pSrcPalette;
+ int m_SrcWidth;
+ int m_SrcHeight;
+ int m_SrcPitch;
+ int m_InterPitch;
+ int m_ExtraMaskPitch;
+ uint8_t* m_pInterBuf;
+ uint8_t* m_pExtraAlphaBuf;
+ int m_TransMethod;
+ int m_Flags;
+ CWeightTable m_WeightTable;
+ int m_CurRow;
+ int m_State;
+};
+
+#endif // CORE_FXGE_DIB_CSTRETCHENGINE_H_
diff --git a/core/fxge/dib/fx_dib_engine_unittest.cpp b/core/fxge/dib/cstretchengine_unittest.cpp
index 86df82442f..2c7e0342de 100644
--- a/core/fxge/dib/fx_dib_engine_unittest.cpp
+++ b/core/fxge/dib/cstretchengine_unittest.cpp
@@ -1,7 +1,9 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
+// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "core/fxge/dib/cstretchengine.h"
+
#include <memory>
#include <utility>
@@ -10,7 +12,6 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/render/cpdf_dibsource.h"
#include "core/fxcrt/fx_memory.h"
-#include "core/fxge/dib/dib_int.h"
#include "core/fxge/fx_dib.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/base/ptr_util.h"
diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h
deleted file mode 100644
index a898a479a2..0000000000
--- a/core/fxge/dib/dib_int.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FXGE_DIB_DIB_INT_H_
-#define CORE_FXGE_DIB_DIB_INT_H_
-
-#include <stdint.h>
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxge/fx_dib.h"
-
-class IFX_ScanlineComposer;
-
-extern const int16_t SDP_Table[513];
-
-class CPDF_FixedMatrix {
- public:
- CPDF_FixedMatrix(const CFX_Matrix& src, int bits) {
- base = 1 << bits;
- a = FXSYS_round(src.a * base);
- b = FXSYS_round(src.b * base);
- c = FXSYS_round(src.c * base);
- d = FXSYS_round(src.d * base);
- e = FXSYS_round(src.e * base);
- f = FXSYS_round(src.f * base);
- }
- inline void Transform(int x, int y, int& x1, int& y1) {
- x1 = (a * x + c * y + e + base / 2) / base;
- y1 = (b * x + d * y + f + base / 2) / base;
- }
- int a, b, c, d, e, f;
- int base;
-};
-#define FPDF_HUGE_IMAGE_SIZE 60000000
-struct PixelWeight {
- int m_SrcStart;
- int m_SrcEnd;
- int m_Weights[1];
-};
-
-class CWeightTable {
- public:
- CWeightTable();
- ~CWeightTable();
-
- bool Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max,
- int flags);
- PixelWeight* GetPixelWeight(int pixel) const;
- int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
- size_t GetPixelWeightSize() const;
-
- private:
- int m_DestMin;
- int m_ItemSize;
- uint8_t* m_pWeightTables;
- size_t m_dwWeightTablesSize;
-};
-
-class CStretchEngine {
- public:
- CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
- FXDIB_Format dest_format,
- int dest_width,
- int dest_height,
- const FX_RECT& clip_rect,
- const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap,
- int flags);
- ~CStretchEngine();
-
- bool Continue(IFX_Pause* pPause);
-
- bool StartStretchHorz();
- bool ContinueStretchHorz(IFX_Pause* pPause);
- void StretchVert();
-
- FXDIB_Format m_DestFormat;
- int m_DestBpp;
- int m_SrcBpp;
- int m_bHasAlpha;
- IFX_ScanlineComposer* m_pDestBitmap;
- int m_DestWidth, m_DestHeight;
- FX_RECT m_DestClip;
- uint8_t* m_pDestScanline;
- uint8_t* m_pDestMaskScanline;
- FX_RECT m_SrcClip;
- CFX_RetainPtr<CFX_DIBSource> m_pSource;
- uint32_t* m_pSrcPalette;
- int m_SrcWidth;
- int m_SrcHeight;
- int m_SrcPitch;
- int m_InterPitch;
- int m_ExtraMaskPitch;
- uint8_t* m_pInterBuf;
- uint8_t* m_pExtraAlphaBuf;
- int m_TransMethod;
- int m_Flags;
- CWeightTable m_WeightTable;
- int m_CurRow;
- int m_State;
-};
-
-FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
- int width,
- int height,
- bool bFlipX,
- bool bFlipY);
-
-#endif // CORE_FXGE_DIB_DIB_INT_H_
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index 68668b92bc..97b1aa7cca 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -8,7 +8,6 @@
#include <utility>
-#include "core/fxge/dib/dib_int.h"
#include "third_party/base/ptr_util.h"
const int16_t SDP_Table[513] = {