Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1858)

Unified Diff: core/fpdfdoc/cpvt_generateap.cpp

Issue 2197353002: Use PaintOperation instead of bFillOrStroke in CPVT_GenerateAP. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use PaintOperation instead of bFillOrStroke in CPVT_GenerateAP. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.h ('k') | core/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpvt_generateap.cpp
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 13ef5061580a90beefb2cc89a169a34a74c25e04..875f53d45a86d69bdca766219f88f5d9aa930122 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -153,7 +153,8 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
crBG = CPVT_Color::ParseColor(*pArray);
}
CFX_ByteTextBuf sAppStream;
- CFX_ByteString sBG = CPVT_GenerateAP::GenerateColorAP(crBG, TRUE);
+ CFX_ByteString sBG =
+ CPVT_GenerateAP::GenerateColorAP(crBG, PaintOperation::FILL);
if (sBG.GetLength() > 0) {
sAppStream << "q\n" << sBG << rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.Width() << " " << rcBBox.Height() << " re f\n"
@@ -263,7 +264,9 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
<< rcBody.Width() << " " << rcBody.Height()
<< " re\nW\nn\n";
}
- sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE)
+ sAppStream << "BT\n"
+ << CPVT_GenerateAP::GenerateColorAP(crText,
+ PaintOperation::FILL)
<< sBody << "ET\n"
<< "Q\nEMC\n";
}
@@ -304,14 +307,16 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
<< "q\n";
sAppStream << rcEdit.left << " " << rcEdit.bottom << " "
<< rcEdit.Width() << " " << rcEdit.Height() << " re\nW\nn\n";
- sAppStream << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE)
+ sAppStream << "BT\n"
+ << CPVT_GenerateAP::GenerateColorAP(crText,
+ PaintOperation::FILL)
<< sEdit << "ET\n"
<< "Q\nEMC\n";
}
CFX_ByteString sButton = CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 220.0f / 255.0f, 220.0f / 255.0f,
220.0f / 255.0f),
- TRUE);
+ PaintOperation::FILL);
if (sButton.GetLength() > 0 && !rcButton.IsEmpty()) {
sAppStream << "q\n" << sButton;
sAppStream << rcButton.left << " " << rcButton.bottom << " "
@@ -386,21 +391,26 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
if (bSelected) {
CFX_FloatRect rcItem = CFX_FloatRect(
rcBody.left, fy - fItemHeight, rcBody.right, fy);
- sBody << "q\n" << CPVT_GenerateAP::GenerateColorAP(
- CPVT_Color(CPVT_Color::kRGB, 0,
- 51.0f / 255.0f, 113.0f / 255.0f),
- TRUE)
+ sBody << "q\n"
+ << CPVT_GenerateAP::GenerateColorAP(
+ CPVT_Color(CPVT_Color::kRGB, 0, 51.0f / 255.0f,
+ 113.0f / 255.0f),
+ PaintOperation::FILL)
<< rcItem.left << " " << rcItem.bottom << " "
<< rcItem.Width() << " " << rcItem.Height() << " re f\n"
<< "Q\n";
- sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(
- CPVT_Color(CPVT_Color::kGray, 1), TRUE)
+ sBody << "BT\n"
+ << CPVT_GenerateAP::GenerateColorAP(
+ CPVT_Color(CPVT_Color::kGray, 1),
+ PaintOperation::FILL)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
CFX_FloatPoint(0.0f, fy),
TRUE, 0)
<< "ET\n";
} else {
- sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE)
+ sBody << "BT\n"
+ << CPVT_GenerateAP::GenerateColorAP(crText,
+ PaintOperation::FILL)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
CFX_FloatPoint(0.0f, fy),
TRUE, 0)
@@ -506,7 +516,7 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
if (pAnnotDict->KeyExist("C")) {
CPDF_Array* pColor = pAnnotDict->GetArrayBy("C");
CPVT_Color color = CPVT_Color::ParseColor(*pColor);
- sAppStream << CPVT_GenerateAP::GenerateColorAP(color, TRUE);
+ sAppStream << CPVT_GenerateAP::GenerateColorAP(color, PaintOperation::FILL);
} else {
// Defaults to 0xFFFF00 color for highlight.
sAppStream << "1 1 0 rg \n";
@@ -661,7 +671,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
switch (nStyle) {
default:
case BorderStyle::SOLID:
- sColor = GenerateColorAP(color, TRUE);
+ sColor = GenerateColorAP(color, PaintOperation::FILL);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " "
@@ -673,7 +683,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
}
break;
case BorderStyle::DASH:
- sColor = GenerateColorAP(color, FALSE);
+ sColor = GenerateColorAP(color, PaintOperation::STROKE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fWidth << " w"
@@ -693,7 +703,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
break;
case BorderStyle::BEVELED:
case BorderStyle::INSET:
- sColor = GenerateColorAP(crLeftTop, TRUE);
+ sColor = GenerateColorAP(crLeftTop, PaintOperation::FILL);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth
@@ -709,7 +719,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
sAppStream << fLeft + fHalfWidth * 2 << " "
<< fBottom + fHalfWidth * 2 << " l f\n";
}
- sColor = GenerateColorAP(crRightBottom, TRUE);
+ sColor = GenerateColorAP(crRightBottom, PaintOperation::FILL);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth
@@ -725,7 +735,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2
<< " l f\n";
}
- sColor = GenerateColorAP(color, TRUE);
+ sColor = GenerateColorAP(color, PaintOperation::FILL);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " "
@@ -736,7 +746,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
}
break;
case BorderStyle::UNDERLINE:
- sColor = GenerateColorAP(color, FALSE);
+ sColor = GenerateColorAP(color, PaintOperation::STROKE);
if (sColor.GetLength() > 0) {
sAppStream << sColor;
sAppStream << fWidth << " w\n";
@@ -751,22 +761,25 @@ CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
// Static.
CFX_ByteString CPVT_GenerateAP::GenerateColorAP(const CPVT_Color& color,
- const FX_BOOL& bFillOrStroke) {
+ PaintOperation nOperation) {
CFX_ByteTextBuf sColorStream;
switch (color.nColorType) {
case CPVT_Color::kRGB:
sColorStream << color.fColor1 << " " << color.fColor2 << " "
- << color.fColor3 << " " << (bFillOrStroke ? "rg" : "RG")
+ << color.fColor3 << " "
+ << (nOperation == PaintOperation::STROKE ? "RG" : "rg")
<< "\n";
break;
case CPVT_Color::kGray:
- sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G")
+ sColorStream << color.fColor1 << " "
+ << (nOperation == PaintOperation::STROKE ? "G" : "g")
<< "\n";
break;
case CPVT_Color::kCMYK:
sColorStream << color.fColor1 << " " << color.fColor2 << " "
<< color.fColor3 << " " << color.fColor4 << " "
- << (bFillOrStroke ? "k" : "K") << "\n";
+ << (nOperation == PaintOperation::STROKE ? "K" : "k")
+ << "\n";
break;
case CPVT_Color::kTransparent:
break;
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.h ('k') | core/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698