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

Side by Side Diff: fpdfsdk/fxedit/fxet_edit.cpp

Issue 2294553002: Revert "Use ->() in CPDF_ColorState" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 3 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_render/fpdf_render_text.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "fpdfsdk/fxedit/include/fxet_edit.h" 7 #include "fpdfsdk/fxedit/include/fxet_edit.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const CFX_FloatRect& rcFill) { 138 const CFX_FloatRect& rcFill) {
139 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); 139 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject);
140 pPathObj->m_Path.MakePrivateCopy(); 140 pPathObj->m_Path.MakePrivateCopy();
141 pPathObj->m_Path->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, 141 pPathObj->m_Path->AppendRect(rcFill.left, rcFill.bottom, rcFill.right,
142 rcFill.top); 142 rcFill.top);
143 143
144 FX_FLOAT rgb[3]; 144 FX_FLOAT rgb[3];
145 rgb[0] = FXARGB_R(crFill) / 255.0f; 145 rgb[0] = FXARGB_R(crFill) / 255.0f;
146 rgb[1] = FXARGB_G(crFill) / 255.0f; 146 rgb[1] = FXARGB_G(crFill) / 255.0f;
147 rgb[2] = FXARGB_B(crFill) / 255.0f; 147 rgb[2] = FXARGB_B(crFill) / 255.0f;
148 pPathObj->m_ColorState.MakePrivateCopy(); 148 pPathObj->m_ColorState.SetFillColor(
149 pPathObj->m_ColorState->SetFillColor(
150 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); 149 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
151 150
152 pPathObj->m_FillType = FXFILL_ALTERNATE; 151 pPathObj->m_FillType = FXFILL_ALTERNATE;
153 pPathObj->m_bStroke = FALSE; 152 pPathObj->m_bStroke = FALSE;
154 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj)); 153 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj));
155 } 154 }
156 155
157 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, 156 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
158 FX_COLORREF crText, 157 FX_COLORREF crText,
159 CPDF_Font* pFont, 158 CPDF_Font* pFont,
(...skipping 11 matching lines...) Expand all
171 pTxtObj->m_TextState->m_TextMode = TextRenderingMode::MODE_FILL; 170 pTxtObj->m_TextState->m_TextMode = TextRenderingMode::MODE_FILL;
172 pTxtObj->m_TextState->m_Matrix[0] = nHorzScale / 100.0f; 171 pTxtObj->m_TextState->m_Matrix[0] = nHorzScale / 100.0f;
173 pTxtObj->m_TextState->m_Matrix[1] = 0; 172 pTxtObj->m_TextState->m_Matrix[1] = 0;
174 pTxtObj->m_TextState->m_Matrix[2] = 0; 173 pTxtObj->m_TextState->m_Matrix[2] = 0;
175 pTxtObj->m_TextState->m_Matrix[3] = 1; 174 pTxtObj->m_TextState->m_Matrix[3] = 1;
176 175
177 FX_FLOAT rgb[3]; 176 FX_FLOAT rgb[3];
178 rgb[0] = FXARGB_R(crText) / 255.0f; 177 rgb[0] = FXARGB_R(crText) / 255.0f;
179 rgb[1] = FXARGB_G(crText) / 255.0f; 178 rgb[1] = FXARGB_G(crText) / 255.0f;
180 rgb[2] = FXARGB_B(crText) / 255.0f; 179 rgb[2] = FXARGB_B(crText) / 255.0f;
181 180 pTxtObj->m_ColorState.SetFillColor(
182 pTxtObj->m_ColorState.MakePrivateCopy();
183 pTxtObj->m_ColorState->SetFillColor(
184 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); 181 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
185 pTxtObj->m_ColorState->SetStrokeColor( 182 pTxtObj->m_ColorState.SetStrokeColor(
186 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); 183 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
187 184
188 pTxtObj->SetPosition(point.x, point.y); 185 pTxtObj->SetPosition(point.x, point.y);
189 pTxtObj->SetText(text); 186 pTxtObj->SetText(text);
190 187
191 CPDF_TextObject* pRet = pTxtObj.get(); 188 CPDF_TextObject* pRet = pTxtObj.get();
192 pObjectHolder->GetPageObjectList()->push_back(std::move(pTxtObj)); 189 pObjectHolder->GetPageObjectList()->push_back(std::move(pTxtObj));
193 return pRet; 190 return pRet;
194 } 191 }
195 192
(...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 int32_t CFX_Edit_RectArray::GetSize() const { 3056 int32_t CFX_Edit_RectArray::GetSize() const {
3060 return m_Rects.GetSize(); 3057 return m_Rects.GetSize();
3061 } 3058 }
3062 3059
3063 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { 3060 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const {
3064 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) 3061 if (nIndex < 0 || nIndex >= m_Rects.GetSize())
3065 return nullptr; 3062 return nullptr;
3066 3063
3067 return m_Rects.GetAt(nIndex); 3064 return m_Rects.GetAt(nIndex);
3068 } 3065 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render_text.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698