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

Side by Side Diff: third_party/agg23/agg_rasterizer_scanline_aa.cpp

Issue 2640143003: Update safe numerics package to get bitwise ops (Closed)
Patch Set: Address reviewer comments Created 3 years, 11 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/fxge/ge/fx_ge_text.cpp ('k') | third_party/base/numerics/safe_conversions.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 1
2 //---------------------------------------------------------------------------- 2 //----------------------------------------------------------------------------
3 // XYQ: 2006-01-22 Copied from AGG project. 3 // XYQ: 2006-01-22 Copied from AGG project.
4 // This file uses only integer data, so it's suitable for all platforms. 4 // This file uses only integer data, so it's suitable for all platforms.
5 //---------------------------------------------------------------------------- 5 //----------------------------------------------------------------------------
6 //---------------------------------------------------------------------------- 6 //----------------------------------------------------------------------------
7 // Anti-Grain Geometry - Version 2.3 7 // Anti-Grain Geometry - Version 2.3
8 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 8 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
9 // 9 //
10 // Permission to copy, use, modify, sell and distribute this software 10 // Permission to copy, use, modify, sell and distribute this software
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 first = poly_base_size; 276 first = poly_base_size;
277 if(dy < 0) { 277 if(dy < 0) {
278 safeP = fy1; 278 safeP = fy1;
279 safeP *= dx; 279 safeP *= dx;
280 if (!safeP.IsValid()) 280 if (!safeP.IsValid())
281 return; 281 return;
282 first = 0; 282 first = 0;
283 incr = -1; 283 incr = -1;
284 dy = -dy; 284 dy = -dy;
285 } 285 }
286 delta = safeP.ValueOrDie() / dy; 286 delta = (safeP / dy).ValueOrDie();
287 mod = safeP.ValueOrDie() % dy; 287 mod = (safeP % dy).ValueOrDie();
288 if(mod < 0) { 288 if(mod < 0) {
289 delta--; 289 delta--;
290 mod += dy; 290 mod += dy;
291 } 291 }
292 x_from = x1 + delta; 292 x_from = x1 + delta;
293 render_hline(ey1, x1, fy1, x_from, first); 293 render_hline(ey1, x1, fy1, x_from, first);
294 ey1 += incr; 294 ey1 += incr;
295 set_cur_cell(x_from >> poly_base_shift, ey1); 295 set_cur_cell(x_from >> poly_base_shift, ey1);
296 if(ey1 != ey2) { 296 if(ey1 != ey2) {
297 safeP = static_cast<int>(poly_base_size); 297 safeP = static_cast<int>(poly_base_size);
298 safeP *= dx; 298 safeP *= dx;
299 if (!safeP.IsValid()) 299 if (!safeP.IsValid())
300 return; 300 return;
301 lift = safeP.ValueOrDie() / dy; 301 lift = (safeP / dy).ValueOrDie();
302 rem = safeP.ValueOrDie() % dy; 302 rem = (safeP % dy).ValueOrDie();
303 if (rem < 0) { 303 if (rem < 0) {
304 lift--; 304 lift--;
305 rem += dy; 305 rem += dy;
306 } 306 }
307 mod -= dy; 307 mod -= dy;
308 while(ey1 != ey2) { 308 while(ey1 != ey2) {
309 delta = lift; 309 delta = lift;
310 mod += rem; 310 mod += rem;
311 if (mod >= 0) { 311 if (mod >= 0) {
312 mod -= dy; 312 mod -= dy;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 for(i = 0; i < m_sorted_y.size(); i++) { 490 for(i = 0; i < m_sorted_y.size(); i++) {
491 const sorted_y& cur_y = m_sorted_y[i]; 491 const sorted_y& cur_y = m_sorted_y[i];
492 if(cur_y.num) { 492 if(cur_y.num) {
493 qsort_cells(m_sorted_cells.data() + cur_y.start, cur_y.num); 493 qsort_cells(m_sorted_cells.data() + cur_y.start, cur_y.num);
494 } 494 }
495 } 495 }
496 m_sorted = true; 496 m_sorted = true;
497 } 497 }
498 } 498 }
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_text.cpp ('k') | third_party/base/numerics/safe_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698