summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-09-08 18:09:59 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-08 18:09:59 -0700
commitcba85abc8a9d2c458b423f0cc3b79a24ddd3f58e (patch)
treed784d639566c988eafcda0a2b76ae1d6bae4960a
parentcf7ac195266fe05f7548c531df32c2b4aa4b5608 (diff)
downloadpdfium-cba85abc8a9d2c458b423f0cc3b79a24ddd3f58e.tar.xz
CPWL_Color::ConvertColorType should compare current color type with the given convert color type.
Previously, it compred the given convert color type with itself. So CPWL_Color::ConvertColorType never converted the color into the given type. Review-Url: https://codereview.chromium.org/2326883002
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index 823873f19d..0574454c4f 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -3308,12 +3308,15 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData,
GetPathDataFromArray(path, PathArray, 23);
}
-void CPWL_Color::ConvertColorType(int32_t other_nColorType) {
- switch (other_nColorType) {
+void CPWL_Color::ConvertColorType(int32_t nConvertColorType) {
+ if (nColorType == nConvertColorType)
+ return;
+
+ switch (nColorType) {
case COLORTYPE_TRANSPARENT:
break;
case COLORTYPE_GRAY:
- switch (other_nColorType) {
+ switch (nConvertColorType) {
case COLORTYPE_RGB:
CPWL_Utils::ConvertGRAY2RGB(fColor1, fColor1, fColor2, fColor3);
break;
@@ -3324,7 +3327,7 @@ void CPWL_Color::ConvertColorType(int32_t other_nColorType) {
}
break;
case COLORTYPE_RGB:
- switch (other_nColorType) {
+ switch (nConvertColorType) {
case COLORTYPE_GRAY:
CPWL_Utils::ConvertRGB2GRAY(fColor1, fColor2, fColor3, fColor1);
break;
@@ -3335,7 +3338,7 @@ void CPWL_Color::ConvertColorType(int32_t other_nColorType) {
}
break;
case COLORTYPE_CMYK:
- switch (other_nColorType) {
+ switch (nConvertColorType) {
case COLORTYPE_GRAY:
CPWL_Utils::ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4,
fColor1);
@@ -3347,5 +3350,5 @@ void CPWL_Color::ConvertColorType(int32_t other_nColorType) {
}
break;
}
- nColorType = other_nColorType;
+ nColorType = nConvertColorType;
}