summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-13 12:04:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 12:04:43 -0700
commit380f20a6000bd640d7fd8f1567961f1f05d79f5a (patch)
treeba8dd6ef2825381171eca97a3b90de9fd7d9ed07 /xfa/fwl/theme
parenta654f0d0889c50d0995bd873c119ae75b0ab5a09 (diff)
downloadpdfium-380f20a6000bd640d7fd8f1567961f1f05d79f5a.tar.xz
Remove some FWL code.
Remove unused or ifdef'd code from FWL. Review URL: https://codereview.chromium.org/1874963002
Diffstat (limited to 'xfa/fwl/theme')
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp9
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.cpp43
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickedtp.cpp43
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp8
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp72
-rw-r--r--xfa/fwl/theme/cfwl_utils.h26
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp50
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h2
8 files changed, 10 insertions, 243 deletions
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 94f69a4389..39a19b7981 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -21,7 +21,6 @@
#define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100))
#define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226))
#define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255))
-#define CHECKBOX_FXGE_CoordinatesAdjust
CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) {
m_pThemeData = new CKBThemeData;
@@ -134,20 +133,12 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget,
pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2);
}
} else {
-#ifdef CHECKBOX_FXGE_CoordinatesAdjust
CFX_RectF rect(*pRect);
rect.Deflate(0, 0, 1, 1);
path.AddEllipse(rect);
-#else
- path.AddEllipse(*pRect);
-#endif
if (bClipSign) {
fillMode = FXFILL_ALTERNATE;
-#ifdef CHECKBOX_FXGE_CoordinatesAdjust
CFX_RectF rtClip(rect);
-#else
- CFX_RectF rtClip(*pRect);
-#endif
rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1,
CHECKBOX_SIZE_SIGNMARGIN - 1);
path.AddEllipse(rtClip);
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 2c5a1c4ff4..b9dd7a0300 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -90,7 +90,7 @@ void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart,
}
return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
}
-#ifdef THEME_XPSimilar
+
void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
uint32_t dwStates,
CFX_Matrix* pMatrix) {
@@ -117,44 +117,3 @@ void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix);
}
-#else
-void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
- uint32_t dwStates,
- CFX_Matrix* pMatrix) {
- FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) ==
- FWL_CMBPARTSTATE_Pressed);
- FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f;
- FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised;
- Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart,
- FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2,
- FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix);
- CFX_Path path;
- path.Create();
- path.AddRectangle(pParams->m_rtPart.left + fWidth,
- pParams->m_rtPart.top + fWidth,
- pParams->m_rtPart.width - 2 * fWidth,
- pParams->m_rtPart.height - 2 * fWidth);
- pParams->m_pGraphics->SaveGraphState();
- CFX_Color crFill(FWLTHEME_COLOR_Background);
- pParams->m_pGraphics->SetFillColor(&crFill);
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix);
- pParams->m_pGraphics->RestoreGraphState();
- FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133);
- switch (pParams->m_dwStates & 0x03) {
- case FWL_CMBPARTSTATE_Normal: {
- }
- case FWL_CMBPARTSTATE_Hovered: {
- }
- case FWL_CMBPARTSTATE_Pressed: {
- argbFill = 0xFF000000;
- break;
- }
- case FWL_CMBPARTSTATE_Disabled: {
- argbFill = 0xFFF0F0F0;
- break;
- }
- }
- DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down,
- argbFill, bPressed, &pParams->m_matrix);
-}
-#endif
diff --git a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp
index 4e1d39a15a..899180faa0 100644
--- a/xfa/fwl/theme/cfwl_datetimepickedtp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickedtp.cpp
@@ -42,7 +42,7 @@ FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
return TRUE;
}
-#ifdef THEME_XPSimilar
+
void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
CFX_Matrix* pMatrix) {
uint32_t dwStates = pParams->m_dwStates;
@@ -70,46 +70,7 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
FWLTHEME_DIRECTION_Down, eState, pMatrix);
}
-#else
-void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
- CFX_Matrix* pMatrix) {
- FX_BOOL bPressed = ((pParams->m_dwStates & FWL_PARTSTATE_DTP_Pressed) ==
- FWL_PARTSTATE_DTP_Pressed);
- FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f;
- FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised;
- Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart,
- FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2,
- FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix);
- CFX_Path path;
- path.Create();
- path.AddRectangle(pParams->m_rtPart.left + fWidth,
- pParams->m_rtPart.top + fWidth,
- pParams->m_rtPart.width - 2 * fWidth,
- pParams->m_rtPart.height - 2 * fWidth);
- pParams->m_pGraphics->SaveGraphState();
- CFX_Color crFill(FWLTHEME_COLOR_Background);
- pParams->m_pGraphics->SetFillColor(&crFill);
- pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pParams->m_pGraphics->RestoreGraphState();
- FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133);
- switch (pParams->m_dwStates & 0x03) {
- case FWL_PARTSTATE_DTP_Normal: {
- }
- case FWL_PARTSTATE_DTP_Hovered: {
- }
- case FWL_PARTSTATE_DTP_Pressed: {
- argbFill = 0xFF000000;
- break;
- }
- case FWL_PARTSTATE_DTP_Disabled: {
- argbFill = 0xFFF0F0F0;
- break;
- }
- }
- DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down,
- argbFill, bPressed, pMatrix);
-}
-#endif
+
void CFWL_DateTimePickerTP::initThemeData() {
uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor;
*pData++ = 0;
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 2d53080b37..154a6bdcea 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -101,23 +101,15 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
break;
}
case FWL_PART_MCD_LBtn: {
-#ifdef THEME_XPSimilar
FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix);
-#else
- DrawLButton(pParams, &pParams->m_matrix);
-#endif
break;
}
case FWL_PART_MCD_RBtn: {
-#ifdef THEME_XPSimilar
FWLTHEME_STATE eState = GetState(pParams->m_dwStates);
DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix);
-#else
- DrawRButton(pParams, &pParams->m_matrix);
-#endif
break;
}
case FWL_PART_MCD_HSeparator: {
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index c6a14f8e94..5db0559195 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -97,7 +97,7 @@ FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
return TRUE;
}
-#ifdef THEME_XPSimilar
+
void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FX_BOOL bVert,
@@ -266,75 +266,7 @@ void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics,
rtArrowBtn.Deflate(1, 1, 1, 1);
DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix);
}
-#else
-void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics,
- const CFX_RectF* pRect,
- FX_BOOL bVert,
- FWLTHEME_STATE eState,
- FX_BOOL bPawButton,
- CFX_Matrix* pMatrix) {
- if (pRect->IsEmpty()) {
- return;
- }
- CFX_RectF rtThumb(*pRect);
- FX_FLOAT fWidth = 2;
- Draw3DRect(pGraphics, FWLTHEME_EDGE_Raised, fWidth, pRect,
- FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2,
- FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix);
- CFX_Path path;
- path.Create();
- path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth,
- pRect->width - 2 * fWidth, pRect->height - 2 * fWidth);
- pGraphics->SaveGraphState();
- CFX_Color crFill(FWLTHEME_COLOR_Background);
- pGraphics->SetFillColor(&crFill);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pGraphics->RestoreGraphState();
-}
-void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics,
- const CFX_RectF* pRect,
- FX_BOOL bVert,
- FWLTHEME_STATE eState,
- FX_BOOL bLowerTrack,
- CFX_Matrix* pMatrix) {
- if (pRect->IsEmpty()) {
- return;
- }
- CFX_Path path;
- path.Create();
- path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
- pGraphics->SaveGraphState();
- CFX_Color clrFill(0xFFF0F0F0);
- pGraphics->SetFillColor(&clrFill);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pGraphics->RestoreGraphState();
-}
-void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics,
- const CFX_RectF* pRect,
- FWLTHEME_DIRECTION eDict,
- FWLTHEME_STATE eState,
- CFX_Matrix* pMatrix) {
- CFX_RectF rtThumb(*pRect);
- FX_FLOAT fWidth = eState == FWLTHEME_STATE_Pressed ? 1.0f : 2.0f;
- FWLTHEME_EDGE eType = eState == FWLTHEME_STATE_Pressed ? FWLTHEME_EDGE_Flat
- : FWLTHEME_EDGE_Raised;
- Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1,
- FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1,
- FWLTHEME_COLOR_EDGERB2, pMatrix);
- CFX_Path path;
- path.Create();
- path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth,
- pRect->width - 2 * fWidth, pRect->height - 2 * fWidth);
- pGraphics->SaveGraphState();
- CFX_Color crFill(FWLTHEME_COLOR_Background);
- pGraphics->SetFillColor(&crFill);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pGraphics->RestoreGraphState();
- DrawArrow(pGraphics, pRect, eDict,
- eState == FWLTHEME_STATE_Disabale ? 0xFFA0A0A0 : 0xFF000000,
- eState == FWLTHEME_STATE_Pressed, pMatrix);
-}
-#endif
+
void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) {
m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172);
m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115);
diff --git a/xfa/fwl/theme/cfwl_utils.h b/xfa/fwl/theme/cfwl_utils.h
index d530b7631b..f2aa381d63 100644
--- a/xfa/fwl/theme/cfwl_utils.h
+++ b/xfa/fwl/theme/cfwl_utils.h
@@ -9,46 +9,28 @@
#include "core/fxcrt/include/fx_system.h"
-#define THEME_XPSimilar
enum FWLTHEME_EDGE {
FWLTHEME_EDGE_Flat = 0,
FWLTHEME_EDGE_Raised,
FWLTHEME_EDGE_Sunken
};
+
enum FWLTHEME_STATE {
FWLTHEME_STATE_Normal = 1,
FWLTHEME_STATE_Hover,
FWLTHEME_STATE_Pressed,
FWLTHEME_STATE_Disabale
};
+
enum FWLTHEME_DIRECTION {
FWLTHEME_DIRECTION_Up = 0,
FWLTHEME_DIRECTION_Down,
FWLTHEME_DIRECTION_Left,
FWLTHEME_DIRECTION_Right
};
-struct FWLCOLOR {
- union {
- uint32_t color;
- struct {
- uint8_t b;
- uint8_t g;
- uint8_t r;
- uint8_t a;
- };
- };
- FWLCOLOR() : color(0) {}
- FWLCOLOR(uint32_t c) : color(c) {}
- FWLCOLOR(const FWLCOLOR& c) : color(c.color) {}
-
- bool operator==(const FWLCOLOR& frColor) { return color == frColor.color; }
- operator uint32_t() { return color; }
-};
#define FWLTHEME_BEZIER FX_BEZIER
#define FWLTHEME_PI FX_PI
-#define FWLTHEME_PI_2_1 (FX_PI / 2.0f)
-#define FWLTHEME_PI_2_3 (3.0f * FX_PI / 2.0f)
#define FWLTHEME_COLOR_EDGELT1 (ArgbEncode(255, 172, 168, 153))
#define FWLTHEME_COLOR_EDGELT2 (ArgbEncode(255, 113, 111, 100))
#define FWLTHEME_COLOR_EDGERB1 (ArgbEncode(255, 241, 239, 226))
@@ -56,11 +38,7 @@ struct FWLCOLOR {
#define FWLTHEME_COLOR_Background (ArgbEncode(255, 236, 233, 216))
#define FWLTHEME_COLOR_BKSelected (ArgbEncode(255, 153, 193, 218))
#define FWLTHEME_COLOR_Green_BKSelected (ArgbEncode(255, 147, 160, 112))
-#ifdef THEME_XPSimilar
#define FWLTHEME_CAPACITY_EdgeFlat 2.0f
-#else
-#define FWLTHEME_CAPACITY_EdgeFlat 0.0f
-#endif
#define FWLTHEME_CAPACITY_EdgeRaised 2.0f
#define FWLTHEME_CAPACITY_EdgeSunken 2.0f
#define FWLTHEME_CAPACITY_FontSize 12.0f
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 05263f17fd..9635ae8c4f 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -220,7 +220,7 @@ FX_ERR CFWL_WidgetTP::FinalizeTTO() {
}
return FWL_ERR_Succeeded;
}
-#ifdef THEME_XPSimilar
+
void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics,
uint32_t dwStyles,
const CFX_RectF* pRect,
@@ -247,34 +247,7 @@ void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics,
pGraphics->StrokePath(&path, pMatrix);
pGraphics->RestoreGraphState();
}
-#else
-void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics,
- uint32_t dwStyles,
- const CFX_RectF* pRect,
- CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!pRect)
- return;
- FWLTHEME_EDGE eType;
- FX_FLOAT fWidth;
- switch (dwStyles & FWL_WGTSTYLE_EdgeMask) {
- case FWL_WGTSTYLE_EdgeRaised: {
- eType = FWLTHEME_EDGE_Raised, fWidth = FWLTHEME_CAPACITY_EdgeRaised;
- break;
- }
- case FWL_WGTSTYLE_EdgeSunken: {
- eType = FWLTHEME_EDGE_Sunken, fWidth = FWLTHEME_CAPACITY_EdgeSunken;
- break;
- }
- case FWL_WGTSTYLE_EdgeFlat:
- default: { return; }
- }
- Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1,
- FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1,
- FWLTHEME_COLOR_EDGERB2, pMatrix);
-}
-#endif
+
void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics,
FWLTHEME_EDGE eType,
FX_FLOAT fWidth,
@@ -674,21 +647,6 @@ void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics,
CFWL_ArrowData::GetInstance()->m_pColorData;
DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
}
-FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor,
- FWLCOLOR renderColor,
- uint8_t scale) {
- FWLCOLOR dstColor;
- uint8_t n = 255 - scale;
- dstColor.a = (uint8_t)(
- ((uint16_t)srcColor.a * n + (uint16_t)renderColor.a * scale) >> 8);
- dstColor.r = (uint8_t)(
- ((uint16_t)srcColor.r * n + (uint16_t)renderColor.r * scale) >> 8);
- dstColor.g = (uint8_t)(
- ((uint16_t)srcColor.g * n + (uint16_t)renderColor.g * scale) >> 8);
- dstColor.b = (uint8_t)(
- ((uint16_t)srcColor.b * n + (uint16_t)renderColor.b * scale) >> 8);
- return dstColor;
-}
CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) {
SetColorData(0);
}
@@ -779,9 +737,7 @@ uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) {
uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
return 0x0000ffff & dwThemeID;
}
-uint32_t FWL_MakeThemeID(uint32_t dwLayout, uint32_t dwColor) {
- return (dwLayout << 16) | (0x0000FFFF & dwColor);
-}
+
CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL;
CFWL_ArrowData* CFWL_ArrowData::GetInstance() {
if (!m_pInstance) {
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 03d575a1d9..771278ef31 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -140,7 +140,6 @@ class CFWL_WidgetTP {
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
CFX_Matrix* pMatrix = NULL);
- FWLCOLOR BlendColor(FWLCOLOR srcColor, FWLCOLOR renderColor, uint8_t scale);
uint32_t m_dwRefCount;
IFDE_TextOut* m_pTextOut;
IFX_Font* m_pFDEFont;
@@ -154,7 +153,6 @@ FX_BOOL FWLTHEME_Init();
void FWLTHEME_Release();
uint32_t FWL_GetThemeLayout(uint32_t dwThemeID);
uint32_t FWL_GetThemeColor(uint32_t dwThemeID);
-uint32_t FWL_MakeThemeID(uint32_t dwLayout, uint32_t dwColor);
class CFWL_ArrowData {
public: