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

Side by Side Diff: xfa/fxgraphics/cfx_path_generator.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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 | « xfa/fxgraphics/cfx_path.cpp ('k') | xfa/fxgraphics/cfx_shading.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 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 "xfa/fxgraphics/cfx_path_generator.h" 7 #include "xfa/fxgraphics/cfx_path_generator.h"
8 8
9 #include "core/fxge/cfx_pathdata.h" 9 #include "core/fxge/cfx_pathdata.h"
10 #include "core/fxge/cfx_renderdevice.h" 10 #include "core/fxge/cfx_renderdevice.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 sweep_angle = FX_PI * 2; 154 sweep_angle = FX_PI * 2;
155 } 155 }
156 if (sweep_angle <= -FX_PI * 2) { 156 if (sweep_angle <= -FX_PI * 2) {
157 sweep_angle = -FX_PI * 2; 157 sweep_angle = -FX_PI * 2;
158 } 158 }
159 m_pPathData->AddPointCount(1); 159 m_pPathData->AddPointCount(1);
160 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1, 160 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1,
161 x + (width * FXSYS_cos(start_angle)), 161 x + (width * FXSYS_cos(start_angle)),
162 y + (height * FXSYS_sin(start_angle)), FXPT_MOVETO); 162 y + (height * FXSYS_sin(start_angle)), FXPT_MOVETO);
163 FX_FLOAT total_sweep = 0, local_sweep = 0, prev_sweep = 0; 163 FX_FLOAT total_sweep = 0, local_sweep = 0, prev_sweep = 0;
164 FX_BOOL done = FALSE; 164 bool done = false;
165 do { 165 do {
166 if (sweep_angle < 0) { 166 if (sweep_angle < 0) {
167 prev_sweep = total_sweep; 167 prev_sweep = total_sweep;
168 local_sweep = -FX_PI / 2; 168 local_sweep = -FX_PI / 2;
169 total_sweep -= FX_PI / 2; 169 total_sweep -= FX_PI / 2;
170 if (total_sweep <= sweep_angle + bezier_arc_angle_epsilon) { 170 if (total_sweep <= sweep_angle + bezier_arc_angle_epsilon) {
171 local_sweep = sweep_angle - prev_sweep; 171 local_sweep = sweep_angle - prev_sweep;
172 done = TRUE; 172 done = true;
173 } 173 }
174 } else { 174 } else {
175 prev_sweep = total_sweep; 175 prev_sweep = total_sweep;
176 local_sweep = FX_PI / 2; 176 local_sweep = FX_PI / 2;
177 total_sweep += FX_PI / 2; 177 total_sweep += FX_PI / 2;
178 if (total_sweep >= sweep_angle - bezier_arc_angle_epsilon) { 178 if (total_sweep >= sweep_angle - bezier_arc_angle_epsilon) {
179 local_sweep = sweep_angle - prev_sweep; 179 local_sweep = sweep_angle - prev_sweep;
180 done = TRUE; 180 done = true;
181 } 181 }
182 } 182 }
183 ArcTo(x, y, width, height, start_angle, local_sweep); 183 ArcTo(x, y, width, height, start_angle, local_sweep);
184 start_angle += local_sweep; 184 start_angle += local_sweep;
185 } while (!done); 185 } while (!done);
186 } 186 }
187 187
188 void CFX_PathGenerator::AddPie(FX_FLOAT x, 188 void CFX_PathGenerator::AddPie(FX_FLOAT x,
189 FX_FLOAT y, 189 FX_FLOAT y,
190 FX_FLOAT width, 190 FX_FLOAT width,
191 FX_FLOAT height, 191 FX_FLOAT height,
192 FX_FLOAT start_angle, 192 FX_FLOAT start_angle,
193 FX_FLOAT sweep_angle) { 193 FX_FLOAT sweep_angle) {
194 if (sweep_angle == 0) { 194 if (sweep_angle == 0) {
195 int old_count = m_pPathData->GetPointCount(); 195 int old_count = m_pPathData->GetPointCount();
196 m_pPathData->AddPointCount(2); 196 m_pPathData->AddPointCount(2);
197 m_pPathData->SetPoint(old_count, x, y, FXPT_MOVETO); 197 m_pPathData->SetPoint(old_count, x, y, FXPT_MOVETO);
198 m_pPathData->SetPoint(old_count + 1, x + (width * FXSYS_cos(start_angle)), 198 m_pPathData->SetPoint(old_count + 1, x + (width * FXSYS_cos(start_angle)),
199 y + (height * FXSYS_sin(start_angle)), FXPT_LINETO); 199 y + (height * FXSYS_sin(start_angle)), FXPT_LINETO);
200 return; 200 return;
201 } 201 }
202 AddArc(x, y, width, height, start_angle, sweep_angle); 202 AddArc(x, y, width, height, start_angle, sweep_angle);
203 m_pPathData->AddPointCount(1); 203 m_pPathData->AddPointCount(1);
204 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1, x, y, 204 m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1, x, y,
205 FXPT_LINETO | FXPT_CLOSEFIGURE); 205 FXPT_LINETO | FXPT_CLOSEFIGURE);
206 } 206 }
OLDNEW
« no previous file with comments | « xfa/fxgraphics/cfx_path.cpp ('k') | xfa/fxgraphics/cfx_shading.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698