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

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_colorstate.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_colorstate.h ('k') | core/fpdfapi/fpdf_page/cpdf_colorstatedata.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_page/cpdf_colorstate.h" 7 #include "core/fpdfapi/fpdf_page/cpdf_colorstate.h"
8 8
9 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" 9 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h"
10 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h"
11 #include "core/include/fxge/fx_dib.h" 11 #include "core/include/fxge/fx_dib.h"
12 12
13 void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS, 13 void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS,
14 FX_FLOAT* pValue, 14 FX_FLOAT* pValue,
15 int nValues) { 15 int nValues) {
16 CPDF_ColorStateData* pData = GetModify(); 16 CPDF_ColorStateData* pData = GetModify();
17 SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues); 17 SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues);
18 } 18 }
19 19
20 void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS, 20 void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS,
21 FX_FLOAT* pValue, 21 FX_FLOAT* pValue,
22 int nValues) { 22 int nValues) {
23 CPDF_ColorStateData* pData = GetModify(); 23 CPDF_ColorStateData* pData = GetModify();
24 SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues); 24 SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues);
25 } 25 }
26 26
27 void CPDF_ColorState::SetColor(CPDF_Color& color, 27 void CPDF_ColorState::SetColor(CPDF_Color& color,
28 FX_DWORD& rgb, 28 uint32_t& rgb,
29 CPDF_ColorSpace* pCS, 29 CPDF_ColorSpace* pCS,
30 FX_FLOAT* pValue, 30 FX_FLOAT* pValue,
31 int nValues) { 31 int nValues) {
32 if (pCS) { 32 if (pCS) {
33 color.SetColorSpace(pCS); 33 color.SetColorSpace(pCS);
34 } else if (color.IsNull()) { 34 } else if (color.IsNull()) {
35 color.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY)); 35 color.SetColorSpace(CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY));
36 } 36 }
37 if (color.m_pCS->CountComponents() > nValues) { 37 if (color.m_pCS->CountComponents() > nValues) {
38 return; 38 return;
39 } 39 }
40 color.SetValue(pValue); 40 color.SetValue(pValue);
41 int R, G, B; 41 int R, G, B;
42 rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; 42 rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
43 } 43 }
44 44
45 void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, 45 void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
46 FX_FLOAT* pValue, 46 FX_FLOAT* pValue,
47 int nValues) { 47 int nValues) {
48 CPDF_ColorStateData* pData = GetModify(); 48 CPDF_ColorStateData* pData = GetModify();
49 pData->m_FillColor.SetValue(pPattern, pValue, nValues); 49 pData->m_FillColor.SetValue(pPattern, pValue, nValues);
50 int R, G, B; 50 int R, G, B;
51 FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B); 51 FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B);
52 if (pPattern->m_PatternType == 1 && 52 if (pPattern->m_PatternType == 1 &&
53 ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) { 53 ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
54 pData->m_FillRGB = 0x00BFBFBF; 54 pData->m_FillRGB = 0x00BFBFBF;
55 return; 55 return;
56 } 56 }
57 pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; 57 pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
58 } 58 }
59 59
60 void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, 60 void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
61 FX_FLOAT* pValue, 61 FX_FLOAT* pValue,
62 int nValues) { 62 int nValues) {
63 CPDF_ColorStateData* pData = GetModify(); 63 CPDF_ColorStateData* pData = GetModify();
64 pData->m_StrokeColor.SetValue(pPattern, pValue, nValues); 64 pData->m_StrokeColor.SetValue(pPattern, pValue, nValues);
65 int R, G, B; 65 int R, G, B;
66 FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B); 66 FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B);
67 if (pPattern->m_PatternType == 1 && 67 if (pPattern->m_PatternType == 1 &&
68 ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) { 68 ((CPDF_TilingPattern*)pPattern)->m_bColored && !ret) {
69 pData->m_StrokeRGB = 0x00BFBFBF; 69 pData->m_StrokeRGB = 0x00BFBFBF;
70 return; 70 return;
71 } 71 }
72 pData->m_StrokeRGB = 72 pData->m_StrokeRGB =
73 pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; 73 pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
74 } 74 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_colorstate.h ('k') | core/fpdfapi/fpdf_page/cpdf_colorstatedata.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698