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

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

Issue 1143663004: Add safe FX_Alloc2D() macro (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Drop one file, indent. 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
« no previous file with comments | « core/src/fxcrt/fx_basic_memmgr_unittest.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('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 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 m_max_blocks(0), 44 m_max_blocks(0),
45 m_coord_blocks(0), 45 m_coord_blocks(0),
46 m_cmd_blocks(0), 46 m_cmd_blocks(0),
47 m_iterator(0) 47 m_iterator(0)
48 { 48 {
49 } 49 }
50 void path_storage::allocate_block(unsigned nb) 50 void path_storage::allocate_block(unsigned nb)
51 { 51 {
52 if(nb >= m_max_blocks) { 52 if(nb >= m_max_blocks) {
53 FX_FLOAT** new_coords = 53 FX_FLOAT** new_coords =
54 FX_Alloc( FX_FLOAT*, (m_max_blocks + block_pool) * 2); 54 FX_Alloc2D(FX_FLOAT*, m_max_blocks + block_pool, 2);
55 if (!new_coords) {
56 return;
57 }
58 unsigned char** new_cmds = 55 unsigned char** new_cmds =
59 (unsigned char**)(new_coords + m_max_blocks + block_pool); 56 (unsigned char**)(new_coords + m_max_blocks + block_pool);
60 if(m_coord_blocks) { 57 if(m_coord_blocks) {
61 FXSYS_memcpy32(new_coords, 58 FXSYS_memcpy32(new_coords,
62 m_coord_blocks, 59 m_coord_blocks,
63 m_max_blocks * sizeof(FX_FLOAT*)); 60 m_max_blocks * sizeof(FX_FLOAT*));
64 FXSYS_memcpy32(new_cmds, 61 FXSYS_memcpy32(new_cmds,
65 m_cmd_blocks, 62 m_cmd_blocks,
66 m_max_blocks * sizeof(unsigned char*)); 63 m_max_blocks * sizeof(unsigned char*));
67 FX_Free(m_coord_blocks); 64 FX_Free(m_coord_blocks);
(...skipping 27 matching lines...) Expand all
95 } 92 }
96 void path_storage::end_poly() 93 void path_storage::end_poly()
97 { 94 {
98 if(m_total_vertices) { 95 if(m_total_vertices) {
99 if(is_vertex(command(m_total_vertices - 1))) { 96 if(is_vertex(command(m_total_vertices - 1))) {
100 add_vertex(0, 0, path_cmd_end_poly | path_flags_close); 97 add_vertex(0, 0, path_cmd_end_poly | path_flags_close);
101 } 98 }
102 } 99 }
103 } 100 }
104 } 101 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_memmgr_unittest.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698