summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_utils.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp240
1 files changed, 0 insertions, 240 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index af69174276..b21047b623 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -11,12 +11,8 @@
#include <sstream>
#include "core/fpdfdoc/cpvt_word.h"
-#include "core/fxge/cfx_graphstatedata.h"
-#include "core/fxge/cfx_pathdata.h"
-#include "core/fxge/cfx_renderdevice.h"
#include "fpdfsdk/fxedit/fxet_edit.h"
#include "fpdfsdk/pdfwindow/cpwl_icon.h"
-#include "fpdfsdk/pdfwindow/cpwl_wnd.h"
CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) {
const float fWidth = crBBox.right - crBBox.left;
@@ -842,239 +838,3 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
return CFX_ByteString(sAppStream);
}
-
-void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rect,
- const FX_COLORREF& color) {
- CFX_PathData path;
- CFX_FloatRect rcTemp(rect);
- path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
- pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_WINDING);
-}
-
-void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_PointF* pPts,
- int32_t nCount,
- const FX_COLORREF& color) {
- CFX_PathData path;
- path.AppendPoint(pPts[0], FXPT_TYPE::MoveTo, false);
- for (int32_t i = 1; i < nCount; i++)
- path.AppendPoint(pPts[i], FXPT_TYPE::LineTo, false);
-
- pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_ALTERNATE);
-}
-
-void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rect,
- const FX_COLORREF& color,
- float fWidth) {
- CFX_PathData path;
- CFX_FloatRect rcTemp(rect);
- path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
-
- CFX_GraphStateData gsd;
- gsd.m_LineWidth = fWidth;
-
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);
-}
-
-void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_PointF& ptMoveTo,
- const CFX_PointF& ptLineTo,
- const FX_COLORREF& color,
- float fWidth) {
- CFX_PathData path;
- path.AppendPoint(ptMoveTo, FXPT_TYPE::MoveTo, false);
- path.AppendPoint(ptLineTo, FXPT_TYPE::LineTo, false);
-
- CFX_GraphStateData gsd;
- gsd.m_LineWidth = fWidth;
-
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);
-}
-
-void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rect,
- const CFX_Color& color,
- int32_t nTransparency) {
- CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect,
- color.ToFXColor(nTransparency));
-}
-
-void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- bool bVertical,
- bool bHorizontal,
- CFX_FloatRect rect,
- int32_t nTransparency,
- int32_t nStartGray,
- int32_t nEndGray) {
- float fStepGray = 1.0f;
-
- if (bVertical) {
- fStepGray = (nEndGray - nStartGray) / rect.Height();
-
- for (float fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) {
- int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom));
- CPWL_Utils::DrawStrokeLine(
- pDevice, pUser2Device, CFX_PointF(rect.left, fy),
- CFX_PointF(rect.right, fy),
- ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f);
- }
- }
-
- if (bHorizontal) {
- fStepGray = (nEndGray - nStartGray) / rect.Width();
-
- for (float fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) {
- int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left));
- CPWL_Utils::DrawStrokeLine(
- pDevice, pUser2Device, CFX_PointF(fx, rect.bottom),
- CFX_PointF(fx, rect.top),
- ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f);
- }
- }
-}
-
-void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- const CFX_FloatRect& rect,
- float fWidth,
- const CFX_Color& color,
- const CFX_Color& crLeftTop,
- const CFX_Color& crRightBottom,
- BorderStyle nStyle,
- int32_t nTransparency) {
- float fLeft = rect.left;
- float fRight = rect.right;
- float fTop = rect.top;
- float fBottom = rect.bottom;
-
- if (fWidth > 0.0f) {
- float fHalfWidth = fWidth / 2.0f;
-
- switch (nStyle) {
- default:
- case BorderStyle::SOLID: {
- CFX_PathData path;
- path.AppendRect(fLeft, fBottom, fRight, fTop);
- path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth,
- fTop - fWidth);
- pDevice->DrawPath(&path, pUser2Device, nullptr,
- color.ToFXColor(nTransparency), 0, FXFILL_ALTERNATE);
- break;
- }
- case BorderStyle::DASH: {
- CFX_PathData path;
- path.AppendPoint(
- CFX_PointF(fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f),
- FXPT_TYPE::MoveTo, false);
- path.AppendPoint(
- CFX_PointF(fLeft + fWidth / 2.0f, fTop - fWidth / 2.0f),
- FXPT_TYPE::LineTo, false);
- path.AppendPoint(
- CFX_PointF(fRight - fWidth / 2.0f, fTop - fWidth / 2.0f),
- FXPT_TYPE::LineTo, false);
- path.AppendPoint(
- CFX_PointF(fRight - fWidth / 2.0f, fBottom + fWidth / 2.0f),
- FXPT_TYPE::LineTo, false);
- path.AppendPoint(
- CFX_PointF(fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f),
- FXPT_TYPE::LineTo, false);
-
- CFX_GraphStateData gsd;
- gsd.SetDashCount(2);
- gsd.m_DashArray[0] = 3.0f;
- gsd.m_DashArray[1] = 3.0f;
- gsd.m_DashPhase = 0;
-
- gsd.m_LineWidth = fWidth;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
- color.ToFXColor(nTransparency), FXFILL_WINDING);
- break;
- }
- case BorderStyle::BEVELED:
- case BorderStyle::INSET: {
- CFX_GraphStateData gsd;
- gsd.m_LineWidth = fHalfWidth;
-
- CFX_PathData pathLT;
-
- pathLT.AppendPoint(CFX_PointF(fLeft + fHalfWidth, fBottom + fHalfWidth),
- FXPT_TYPE::MoveTo, false);
- pathLT.AppendPoint(CFX_PointF(fLeft + fHalfWidth, fTop - fHalfWidth),
- FXPT_TYPE::LineTo, false);
- pathLT.AppendPoint(CFX_PointF(fRight - fHalfWidth, fTop - fHalfWidth),
- FXPT_TYPE::LineTo, false);
- pathLT.AppendPoint(
- CFX_PointF(fRight - fHalfWidth * 2, fTop - fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathLT.AppendPoint(
- CFX_PointF(fLeft + fHalfWidth * 2, fTop - fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathLT.AppendPoint(
- CFX_PointF(fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathLT.AppendPoint(CFX_PointF(fLeft + fHalfWidth, fBottom + fHalfWidth),
- FXPT_TYPE::LineTo, false);
-
- pDevice->DrawPath(&pathLT, pUser2Device, &gsd,
- crLeftTop.ToFXColor(nTransparency), 0,
- FXFILL_ALTERNATE);
-
- CFX_PathData pathRB;
- pathRB.AppendPoint(CFX_PointF(fRight - fHalfWidth, fTop - fHalfWidth),
- FXPT_TYPE::MoveTo, false);
- pathRB.AppendPoint(
- CFX_PointF(fRight - fHalfWidth, fBottom + fHalfWidth),
- FXPT_TYPE::LineTo, false);
- pathRB.AppendPoint(CFX_PointF(fLeft + fHalfWidth, fBottom + fHalfWidth),
- FXPT_TYPE::LineTo, false);
- pathRB.AppendPoint(
- CFX_PointF(fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathRB.AppendPoint(
- CFX_PointF(fRight - fHalfWidth * 2, fBottom + fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathRB.AppendPoint(
- CFX_PointF(fRight - fHalfWidth * 2, fTop - fHalfWidth * 2),
- FXPT_TYPE::LineTo, false);
- pathRB.AppendPoint(CFX_PointF(fRight - fHalfWidth, fTop - fHalfWidth),
- FXPT_TYPE::LineTo, false);
-
- pDevice->DrawPath(&pathRB, pUser2Device, &gsd,
- crRightBottom.ToFXColor(nTransparency), 0,
- FXFILL_ALTERNATE);
-
- CFX_PathData path;
-
- path.AppendRect(fLeft, fBottom, fRight, fTop);
- path.AppendRect(fLeft + fHalfWidth, fBottom + fHalfWidth,
- fRight - fHalfWidth, fTop - fHalfWidth);
-
- pDevice->DrawPath(&path, pUser2Device, &gsd,
- color.ToFXColor(nTransparency), 0, FXFILL_ALTERNATE);
- break;
- }
- case BorderStyle::UNDERLINE: {
- CFX_PathData path;
- path.AppendPoint(CFX_PointF(fLeft, fBottom + fWidth / 2),
- FXPT_TYPE::MoveTo, false);
- path.AppendPoint(CFX_PointF(fRight, fBottom + fWidth / 2),
- FXPT_TYPE::LineTo, false);
-
- CFX_GraphStateData gsd;
- gsd.m_LineWidth = fWidth;
-
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
- color.ToFXColor(nTransparency), FXFILL_ALTERNATE);
- break;
- }
- }
- }
-}