diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-25 19:28:10 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-25 19:28:10 +0000 |
commit | 5ada7bcf1f200eaa8d78ea2c74233b6b54f6d5f5 (patch) | |
tree | d30f97e0b55be2a3ca3b720e80e075d36f11e941 /core/fxge/win32 | |
parent | 0c327657fb8c23934c5beae520e7a97a48e2eef6 (diff) | |
download | pdfium-5ada7bcf1f200eaa8d78ea2c74233b6b54f6d5f5.tar.xz |
Change StartDIBits() to take a matrix by reference.
In RenderDeviceDriverIface and related classes, and for related methods
in the call stack.
Change-Id: I420fafe70084eb3941dffc6f9f51ecbed79581de
Reviewed-on: https://pdfium-review.googlesource.com/c/44552
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 15 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_print.cpp | 22 | ||||
-rw-r--r-- | core/fxge/win32/win32_int.h | 8 |
5 files changed, 24 insertions, 25 deletions
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 921005dd70..becf99b52d 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -348,7 +348,7 @@ bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBBase>& pSource, CFX_Matrix matrix((float)(pSource->GetWidth()), 0.0f, 0.0f, -(float)(pSource->GetHeight()), (float)(left), (float)(top + pSource->GetHeight())); - return DrawDIBits(pSource, color, &matrix, 0); + return DrawDIBits(pSource, color, matrix, 0); } bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, @@ -361,18 +361,17 @@ bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, StartRendering(); CFX_Matrix matrix((float)(dest_width), 0.0f, 0.0f, (float)(-dest_height), (float)(dest_left), (float)(dest_top + dest_height)); - return DrawDIBits(pSource, color, &matrix, flags); + return DrawDIBits(pSource, color, matrix, flags); } bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBBase>& pSource, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t flags) { StartRendering(); - if ((pMatrix->a == 0 && pMatrix->b == 0) || - (pMatrix->c == 0 && pMatrix->d == 0)) { + if ((matrix.a == 0 && matrix.b == 0) || (matrix.c == 0 && matrix.d == 0)) return true; - } + if (pSource->HasAlpha()) return false; @@ -383,8 +382,8 @@ bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBBase>& pSource, m_pStream->WriteString("q\n"); std::ostringstream buf; - buf << "[" << pMatrix->a << " " << pMatrix->b << " " << pMatrix->c << " " - << pMatrix->d << " " << pMatrix->e << " " << pMatrix->f << "]cm "; + buf << "[" << matrix.a << " " << matrix.b << " " << matrix.c << " " + << matrix.d << " " << matrix.e << " " << matrix.f << "]cm "; int width = pSource->GetWidth(); int height = pSource->GetHeight(); diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h index e54c2f8744..b5107d9ab1 100644 --- a/core/fxge/win32/cfx_psrenderer.h +++ b/core/fxge/win32/cfx_psrenderer.h @@ -65,7 +65,7 @@ class CFX_PSRenderer { uint32_t flags); bool DrawDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t flags); bool DrawText(int nChars, const FXTEXT_CHARPOS* pCharPos, diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 537e67564c..4b0b01e56e 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -1330,7 +1330,7 @@ bool CGdiDisplayDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, bool CGdiDisplayDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) { diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index 1f9b9510f7..b92a46d08f 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -161,7 +161,7 @@ bool CGdiPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pSource, bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) { @@ -169,12 +169,12 @@ bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pSource, (pSource->IsAlphaMask() && (pSource->GetBPP() != 1))) { return false; } - CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); + CFX_FloatRect unit_rect = matrix.GetUnitRect(); FX_RECT full_rect = unit_rect.GetOuterRect(); - if (fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && fabs(pMatrix->c) < 0.5f && - pMatrix->d != 0) { - bool bFlipX = pMatrix->a < 0; - bool bFlipY = pMatrix->d > 0; + if (fabs(matrix.b) < 0.5f && matrix.a != 0 && fabs(matrix.c) < 0.5f && + matrix.d != 0) { + bool bFlipX = matrix.a < 0; + bool bFlipY = matrix.d > 0; return StretchDIBits(pSource, color, bFlipX ? full_rect.right : full_rect.left, bFlipY ? full_rect.bottom : full_rect.top, @@ -182,11 +182,11 @@ bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pSource, bFlipY ? -full_rect.Height() : full_rect.Height(), nullptr, 0, blend_type); } - if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f) + if (fabs(matrix.a) >= 0.5f || fabs(matrix.d) >= 0.5f) return false; RetainPtr<CFX_DIBitmap> pTransformed = - pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0); + pSource->SwapXY(matrix.c > 0, matrix.b < 0); if (!pTransformed) return false; @@ -482,7 +482,7 @@ bool CPSPrinterDriver::StretchDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) { @@ -493,7 +493,7 @@ bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, return false; *handle = nullptr; - return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags); + return m_PSRenderer.DrawDIBits(pBitmap, color, matrix, render_flags); } bool CPSPrinterDriver::DrawDeviceText(int nChars, @@ -598,7 +598,7 @@ bool CTextOnlyPrinterDriver::StartDIBits( const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) { diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 2a61a4e651..9819be686f 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -215,7 +215,7 @@ class CGdiDisplayDriver final : public CGdiDeviceDriver { bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) override; @@ -254,7 +254,7 @@ class CGdiPrinterDriver final : public CGdiDeviceDriver { bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) override; @@ -313,7 +313,7 @@ class CPSPrinterDriver final : public RenderDeviceDriverIface { bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) override; @@ -376,7 +376,7 @@ class CTextOnlyPrinterDriver final : public RenderDeviceDriverIface { bool StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap, int bitmap_alpha, uint32_t color, - const CFX_Matrix* pMatrix, + const CFX_Matrix& matrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, BlendMode blend_type) override; |