diff options
author | Lei Zhang <thestig@chromium.org> | 2018-01-30 18:31:40 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-30 18:31:40 +0000 |
commit | 95dd8dad6b1b2ac31aca84afe677205c7ed47f7f (patch) | |
tree | ecd066f9fd3033e1f6218a77ec8b2029ff63b592 | |
parent | acbef05aa0dbceabf47d700968ccd6569524fe74 (diff) | |
download | pdfium-95dd8dad6b1b2ac31aca84afe677205c7ed47f7f.tar.xz |
Remove not reachable branch in fxge code.
BUG=chromium:805881
Change-Id: I5f920649f425d0cfc47c780b36ed70f23cbe1299
Reviewed-on: https://pdfium-review.googlesource.com/24191
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fxge/skia/fx_skia_device.cpp | 2 | ||||
-rw-r--r-- | core/fxge/skia/fx_skia_device.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 18 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 35 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 5 |
5 files changed, 27 insertions, 35 deletions
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index ab8efff72c..82758400be 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -1856,7 +1856,7 @@ bool CFX_SkiaDeviceDriver::SetClip_PathFill( bool CFX_SkiaDeviceDriver::SetClip_PathStroke( const CFX_PathData* pPathData, // path info - const CFX_Matrix* pObject2Device, // optional transformation + const CFX_Matrix* pObject2Device, // required transformation const CFX_GraphStateData* pGraphState // graphic state, for pen attributes ) { bool cached = m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState); diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index 7dfdef4de8..c2e6c013d9 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -50,7 +50,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { /** Set clipping path using stroked region */ bool SetClip_PathStroke( const CFX_PathData* pPathData, // path info - const CFX_Matrix* pObject2Device, // optional transformation + const CFX_Matrix* pObject2Device, // required transformation const CFX_GraphStateData* pGraphState) // graphic state, for pen attributes override; diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 1513c07c68..417a1d7b85 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -234,23 +234,19 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_GraphStateData* pGraphState) { StartRendering(); SetGraphState(pGraphState); - if (pObject2Device) { - std::ostringstream buf; - buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " " - << pObject2Device->c << " " << pObject2Device->d << " " - << pObject2Device->e << " " << pObject2Device->f << "]cm "; - m_pStream->WriteBlock(buf.str().c_str(), buf.tellp()); - } + + std::ostringstream buf; + buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " " + << pObject2Device->c << " " << pObject2Device->d << " " + << pObject2Device->e << " " << pObject2Device->f << "]cm "; + m_pStream->WriteBlock(buf.str().c_str(), buf.tellp()); OutputPath(pPathData, nullptr); CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit); m_ClipBox.Intersect(pObject2Device->TransformRect(rect).GetOuterRect()); - m_pStream->WriteString("strokepath W n"); - if (pObject2Device) - m_pStream->WriteString(" sm"); - m_pStream->WriteString("\n"); + m_pStream->WriteString("strokepath W n sm\n"); } bool CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 492b0b57df..41dc22060b 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -91,28 +91,24 @@ bool IsGDIEnabled() { return true; } -HPEN CreatePen(const CFX_GraphStateData* pGraphState, - const CFX_Matrix* pMatrix, - uint32_t argb) { - float width; - float scale = 1.f; - if (pMatrix) +HPEN CreateExtPen(const CFX_GraphStateData* pGraphState, + const CFX_Matrix* pMatrix, + uint32_t argb) { + ASSERT(pGraphState); + + float scale = 1.0f; + if (pMatrix) { scale = fabs(pMatrix->a) > fabs(pMatrix->b) ? fabs(pMatrix->a) : fabs(pMatrix->b); - if (pGraphState) { - width = scale * pGraphState->m_LineWidth; - } else { - width = 1.0f; } + float width = std::max(scale * pGraphState->m_LineWidth, 1.0f); + uint32_t PenStyle = PS_GEOMETRIC; - if (width < 1) { - width = 1; - } - if (pGraphState->m_DashCount) { + if (pGraphState->m_DashCount) PenStyle |= PS_USERSTYLE; - } else { + else PenStyle |= PS_SOLID; - } + switch (pGraphState->m_LineCap) { case 0: PenStyle |= PS_ENDCAP_FLAT; @@ -135,6 +131,7 @@ HPEN CreatePen(const CFX_GraphStateData* pGraphState, PenStyle |= PS_JOIN_BEVEL; break; } + int a; FX_COLORREF rgb; std::tie(a, rgb) = ArgbToColorRef(argb); @@ -1005,7 +1002,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, ((m_DeviceClass != FXDC_PRINTER && !(fill_mode & FXFILL_FULLCOVER)) || (pGraphState && pGraphState->m_DashCount))) { if (!((!pMatrix || !pMatrix->WillScale()) && pGraphState && - pGraphState->m_LineWidth == 1.f && + pGraphState->m_LineWidth == 1.0f && (pPathData->GetPoints().size() == 5 || pPathData->GetPoints().size() == 4) && pPathData->IsRect())) { @@ -1023,7 +1020,7 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, HBRUSH hBrush = nullptr; if (pGraphState && stroke_alpha) { SetMiterLimit(m_hDC, pGraphState->m_MiterLimit, nullptr); - hPen = CreatePen(pGraphState, pMatrix, stroke_color); + hPen = CreateExtPen(pGraphState, pMatrix, stroke_color); hPen = (HPEN)SelectObject(m_hDC, hPen); } if (fill_mode && fill_alpha) { @@ -1111,7 +1108,7 @@ bool CGdiDeviceDriver::SetClip_PathStroke( const CFX_PathData* pPathData, const CFX_Matrix* pMatrix, const CFX_GraphStateData* pGraphState) { - HPEN hPen = CreatePen(pGraphState, pMatrix, 0xff000000); + HPEN hPen = CreateExtPen(pGraphState, pMatrix, 0xff000000); hPen = (HPEN)SelectObject(m_hDC, hPen); SetPathToDC(m_hDC, pPathData, pMatrix); WidenPath(m_hDC); diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index d784a0fa37..64c8ea7408 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -730,13 +730,12 @@ GpPen* GdipCreatePenImpl(const CFX_GraphStateData* pGraphState, bool bTextMode) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; - float width = pGraphState ? pGraphState->m_LineWidth : 1.0f; + float width = pGraphState->m_LineWidth; if (!bTextMode) { float unit = pMatrix ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2) : 1.0f; - if (width < unit) - width = unit; + width = std::max(width, unit); } GpPen* pPen = nullptr; CallFunc(GdipCreatePen1)((Gdiplus::ARGB)argb, width, UnitWorld, &pPen); |