summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-23 09:59:05 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-23 15:26:17 +0000
commitfc54e054811510c3d7c8a9c6af6c90c3222c7029 (patch)
tree98025207bd4d1f397be489fe54c42b148cf40137 /fpdfsdk/cpdfsdk_widget.cpp
parenta0061afa12e0fec210727c9478adb8ac78c5d63c (diff)
downloadpdfium-fc54e054811510c3d7c8a9c6af6c90c3222c7029.tar.xz
Cleanup PWL_Utils.
This CL removes unused methods, moves methods to correct files and removes unused defines. Change-Id: I5087869b451e57d5325831814f0fa1c7f222cf4d Reviewed-on: https://pdfium-review.googlesource.com/2823 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp45
1 files changed, 20 insertions, 25 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index a4506e74a6..cd86f7a0b5 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -889,11 +889,10 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CPWL_Color crBackground, crBorder;
-
+ CPWL_Color crBackground;
+ CPWL_Color crBorder;
int iColorType;
FX_FLOAT fc[4];
-
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
@@ -904,7 +903,8 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop, crRightBottom;
+ CPWL_Color crLeftTop;
+ CPWL_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
@@ -914,7 +914,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1050,8 +1050,7 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
font_map.SetAPType("D");
- csAP = CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
+ csAP = CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom,
nBorderStyle, dsBorder) +
@@ -1094,7 +1093,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1107,7 +1106,6 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
CFX_FloatRect rcWindow = GetRotatedRect();
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
-
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
@@ -1115,7 +1113,6 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
int32_t nStyle = 0;
-
CFX_WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
@@ -1167,8 +1164,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
}
CFX_ByteString csAP_D_ON =
- CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
+ CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
crLeftTop, crRightBottom, nBorderStyle,
dsBorder);
@@ -1207,8 +1203,8 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop, crRightBottom;
-
+ CPWL_Color crLeftTop;
+ CPWL_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::DASH:
@@ -1217,7 +1213,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
@@ -1238,7 +1234,6 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
}
int32_t nStyle = 0;
-
CFX_WideString csWCaption = pControl->GetNormalCaption();
if (csWCaption.GetLength() > 0) {
switch (csWCaption[0]) {
@@ -1273,7 +1268,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
if (nStyle == PCS_CIRCLE) {
if (nBorderStyle == BorderStyle::BEVELED) {
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ crRightBottom = crBackground - 0.25f;
} else if (nBorderStyle == BorderStyle::INSET) {
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5f);
crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75f);
@@ -1311,9 +1306,9 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CFX_ByteString csAP_D_ON;
if (nStyle == PCS_CIRCLE) {
- CPWL_Color crBK = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ CPWL_Color crBK = crBackground - 0.25f;
if (nBorderStyle == BorderStyle::BEVELED) {
- crLeftTop = CPWL_Utils::SubstractColor(crBackground, 0.25f);
+ crLeftTop = crBackground - 0.25f;
crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
crBK = crBackground;
} else if (nBorderStyle == BorderStyle::INSET) {
@@ -1326,11 +1321,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
rcCenter, fBorderWidth, crBorder, crLeftTop, crRightBottom,
nBorderStyle, dsBorder);
} else {
- csAP_D_ON = CPWL_Utils::GetRectFillAppStream(
- rcWindow, CPWL_Utils::SubstractColor(crBackground, 0.25f)) +
- CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
- crLeftTop, crRightBottom,
- nBorderStyle, dsBorder);
+ csAP_D_ON =
+ CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground - 0.25f) +
+ CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder,
+ crLeftTop, crRightBottom, nBorderStyle,
+ dsBorder);
}
CFX_ByteString csAP_D_OFF = csAP_D_ON;
@@ -1707,7 +1702,7 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
case BorderStyle::BEVELED:
fBorderWidth *= 2;
crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
- crRightBottom = CPWL_Utils::DevideColor(crBackground, 2);
+ crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;