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

Side by Side Diff: core/src/fxge/agg/agg23/fx_agg_path_storage.cpp

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. Created 5 years, 7 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
OLDNEW
1 1
2 //---------------------------------------------------------------------------- 2 //----------------------------------------------------------------------------
3 // XYQ: 2006-01-22 Copied from AGG project. 3 // XYQ: 2006-01-22 Copied from AGG project.
4 // TODO: This file uses intensive floating point operations, so it's NOT suitabl e 4 // TODO: This file uses intensive floating point operations, so it's NOT suitabl e
5 // for platforms like Symbian OS. We need to change to FIX format. 5 // for platforms like Symbian OS. We need to change to FIX format.
6 //---------------------------------------------------------------------------- 6 //----------------------------------------------------------------------------
7 //---------------------------------------------------------------------------- 7 //----------------------------------------------------------------------------
8 // Anti-Grain Geometry - Version 2.3 8 // Anti-Grain Geometry - Version 2.3
9 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 9 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
10 // 10 //
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 FX_Free(m_coord_blocks); 64 FX_Free(m_coord_blocks);
65 } 65 }
66 m_coord_blocks = new_coords; 66 m_coord_blocks = new_coords;
67 m_cmd_blocks = new_cmds; 67 m_cmd_blocks = new_cmds;
68 m_max_blocks += block_pool; 68 m_max_blocks += block_pool;
69 } 69 }
70 m_coord_blocks[nb] = 70 m_coord_blocks[nb] =
71 FX_Alloc( FX_FLOAT, block_size * 2 + 71 FX_Alloc( FX_FLOAT, block_size * 2 +
72 block_size / 72 block_size /
73 (sizeof(FX_FLOAT) / sizeof(unsigned char))); 73 (sizeof(FX_FLOAT) / sizeof(unsigned char)));
74 if (!m_coord_blocks[nb]) {
75 return;
76 }
77 m_cmd_blocks[nb] = 74 m_cmd_blocks[nb] =
78 (unsigned char*)(m_coord_blocks[nb] + block_size * 2); 75 (unsigned char*)(m_coord_blocks[nb] + block_size * 2);
79 m_total_blocks++; 76 m_total_blocks++;
80 } 77 }
81 void path_storage::rewind(unsigned path_id) 78 void path_storage::rewind(unsigned path_id)
82 { 79 {
83 m_iterator = path_id; 80 m_iterator = path_id;
84 } 81 }
85 void path_storage::curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1, 82 void path_storage::curve4(FX_FLOAT x_ctrl1, FX_FLOAT y_ctrl1,
86 FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2, 83 FX_FLOAT x_ctrl2, FX_FLOAT y_ctrl2,
87 FX_FLOAT x_to, FX_FLOAT y_to) 84 FX_FLOAT x_to, FX_FLOAT y_to)
88 { 85 {
89 add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4); 86 add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
90 add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4); 87 add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4);
91 add_vertex(x_to, y_to, path_cmd_curve4); 88 add_vertex(x_to, y_to, path_cmd_curve4);
92 } 89 }
93 void path_storage::end_poly() 90 void path_storage::end_poly()
94 { 91 {
95 if(m_total_vertices) { 92 if(m_total_vertices) {
96 if(is_vertex(command(m_total_vertices - 1))) { 93 if(is_vertex(command(m_total_vertices - 1))) {
97 add_vertex(0, 0, path_cmd_end_poly | path_flags_close); 94 add_vertex(0, 0, path_cmd_end_poly | path_flags_close);
98 } 95 }
99 } 96 }
100 } 97 }
101 } 98 }
OLDNEW
« no previous file with comments | « core/src/fxge/agg/agg23/agg_array.h ('k') | core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698