summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
-rw-r--r--core/fpdfdoc/cpdf_defaultappearance.h1
-rw-r--r--core/fxge/cfx_renderdevice.cpp18
-rw-r--r--core/fxge/cfx_renderdevice.h17
-rw-r--r--core/fxge/skia/fx_skia_device.cpp13
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp9
6 files changed, 34 insertions, 28 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 0e8975da61..3f7b4923dc 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2391,8 +2391,8 @@ void CPDF_RenderStatus::CompositeDIBitmap(
if (bitmap_alpha < 255) {
#ifdef _SKIA_SUPPORT_
std::unique_ptr<CFX_ImageRenderer> dummy;
- CFX_Matrix m(pDIBitmap->GetWidth(), 0, 0, -pDIBitmap->GetHeight(), left,
- top + pDIBitmap->GetHeight());
+ CFX_Matrix m = CFX_RenderDevice::GetFlipMatrix(
+ pDIBitmap->GetWidth(), pDIBitmap->GetHeight(), left, top);
m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, m, 0, &dummy);
return;
#else
diff --git a/core/fpdfdoc/cpdf_defaultappearance.h b/core/fpdfdoc/cpdf_defaultappearance.h
index 73e35c7cd4..c386269826 100644
--- a/core/fpdfdoc/cpdf_defaultappearance.h
+++ b/core/fpdfdoc/cpdf_defaultappearance.h
@@ -10,7 +10,6 @@
#include <utility>
#include "core/fpdfapi/parser/cpdf_simple_parser.h"
-#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/cfx_color.h"
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index 90e80be28e..8fe1f6b3b0 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -364,15 +364,9 @@ FXTEXT_CHARPOS::FXTEXT_CHARPOS()
FXTEXT_CHARPOS::FXTEXT_CHARPOS(const FXTEXT_CHARPOS&) = default;
-FXTEXT_CHARPOS::~FXTEXT_CHARPOS(){};
+FXTEXT_CHARPOS::~FXTEXT_CHARPOS() = default;
-CFX_RenderDevice::CFX_RenderDevice()
- : m_pBitmap(nullptr),
- m_Width(0),
- m_Height(0),
- m_bpp(0),
- m_RenderCaps(0),
- m_DeviceClass(0) {}
+CFX_RenderDevice::CFX_RenderDevice() = default;
CFX_RenderDevice::~CFX_RenderDevice() {
RestoreState(false);
@@ -381,6 +375,14 @@ CFX_RenderDevice::~CFX_RenderDevice() {
#endif
}
+// static
+CFX_Matrix CFX_RenderDevice::GetFlipMatrix(float width,
+ float height,
+ float left,
+ float top) {
+ return CFX_Matrix(width, 0, 0, -height, left, top + height);
+}
+
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
void CFX_RenderDevice::Flush(bool release) {
if (release)
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 5eede11636..4f802af3d7 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -11,6 +11,7 @@
#include <vector>
#include "core/fpdfdoc/cpdf_defaultappearance.h"
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/unowned_ptr.h"
#include "core/fxge/fx_dib.h"
@@ -101,7 +102,11 @@ class CFX_RenderDevice {
CFX_RenderDevice();
virtual ~CFX_RenderDevice();
- // Take ownership of |pDriver|.
+ static CFX_Matrix GetFlipMatrix(float width,
+ float height,
+ float left,
+ float top);
+
void SetDeviceDriver(std::unique_ptr<RenderDeviceDriverIface> pDriver);
RenderDeviceDriverIface* GetDeviceDriver() const {
return m_pDeviceDriver.get();
@@ -297,11 +302,11 @@ class CFX_RenderDevice {
BlendMode blend_type);
RetainPtr<CFX_DIBitmap> m_pBitmap;
- int m_Width;
- int m_Height;
- int m_bpp;
- int m_RenderCaps;
- int m_DeviceClass;
+ int m_Width = 0;
+ int m_Height = 0;
+ int m_bpp = 0;
+ int m_RenderCaps = 0;
+ int m_DeviceClass = 0;
FX_RECT m_ClipBox;
std::unique_ptr<RenderDeviceDriverIface> m_pDeviceDriver;
};
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 2067243c04..1cda61f4fe 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -2247,8 +2247,8 @@ bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr<CFX_DIBBase>& pBitmap,
return true;
#ifdef _SKIA_SUPPORT_
- CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
- top + pBitmap->GetHeight());
+ CFX_Matrix m = CFX_RenderDevice::GetFlipMatrix(
+ pBitmap->GetWidth(), pBitmap->GetHeight(), left, top);
std::unique_ptr<CFX_ImageRenderer> dummy;
return StartDIBits(pBitmap, 0xFF, argb, m, 0, &dummy, blend_type);
#endif // _SKIA_SUPPORT_
@@ -2280,9 +2280,9 @@ bool CFX_SkiaDeviceDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource,
m_pCache->FlushForDraw();
if (!m_pBitmap->GetBuffer())
return true;
- CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left,
- dest_top + dest_height);
+ CFX_Matrix m = CFX_RenderDevice::GetFlipMatrix(dest_width, dest_height,
+ dest_left, dest_top);
m_pCanvas->save();
SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom,
pClipRect->right, pClipRect->top);
@@ -2501,8 +2501,9 @@ bool CFX_SkiaDeviceDriver::SetBitsWithMask(
BlendMode blend_type) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return true;
- CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), dest_left,
- dest_top + pBitmap->GetHeight());
+
+ CFX_Matrix m = CFX_RenderDevice::GetFlipMatrix(
+ pBitmap->GetWidth(), pBitmap->GetHeight(), dest_left, dest_top);
return DrawBitsWithMask(pBitmap, pMask, bitmap_alpha, m, blend_type);
}
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 9e01bd2d06..9f5a7cd139 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -346,9 +346,8 @@ bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBBase>& pSource,
int left,
int top) {
StartRendering();
- CFX_Matrix matrix((float)(pSource->GetWidth()), 0.0f, 0.0f,
- -(float)(pSource->GetHeight()), (float)(left),
- (float)(top + pSource->GetHeight()));
+ CFX_Matrix matrix = CFX_RenderDevice::GetFlipMatrix(
+ pSource->GetWidth(), pSource->GetHeight(), left, top);
return DrawDIBits(pSource, color, matrix, 0);
}
@@ -360,8 +359,8 @@ bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource,
int dest_height,
uint32_t flags) {
StartRendering();
- CFX_Matrix matrix((float)(dest_width), 0.0f, 0.0f, (float)(-dest_height),
- (float)(dest_left), (float)(dest_top + dest_height));
+ CFX_Matrix matrix = CFX_RenderDevice::GetFlipMatrix(dest_width, dest_height,
+ dest_left, dest_top);
return DrawDIBits(pSource, color, matrix, flags);
}