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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp

Issue 1136673005: Merge to XFA: Add safe FX_Alloc2D() macro (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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/fpdfapi/fpdf_render/fpdf_render_cache.cpp ('k') | core/src/fpdftext/fpdf_text.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 // 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 "../../../include/fpdfapi/fpdf_render.h" 7 #include "../../../include/fpdfapi/fpdf_render.h"
8 #include "../../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return; 415 return;
416 } 416 }
417 int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow"); 417 int row_verts = pShadingStream->GetDict()->GetInteger("VerticesPerRow");
418 if (row_verts < 2) { 418 if (row_verts < 2) {
419 return; 419 return;
420 } 420 }
421 CPDF_MeshStream stream; 421 CPDF_MeshStream stream;
422 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) { 422 if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS)) {
423 return; 423 return;
424 } 424 }
425 CPDF_MeshVertex* vertex = FX_Alloc(CPDF_MeshVertex, row_verts * 2); 425 CPDF_MeshVertex* vertex = FX_Alloc2D(CPDF_MeshVertex, row_verts, 2);
426 if (!stream.GetVertexRow(vertex, row_verts, pObject2Bitmap)) { 426 if (!stream.GetVertexRow(vertex, row_verts, pObject2Bitmap)) {
427 FX_Free(vertex); 427 FX_Free(vertex);
428 return; 428 return;
429 } 429 }
430 int last_index = 0; 430 int last_index = 0;
431 while (1) { 431 while (1) {
432 CPDF_MeshVertex* last_row = vertex + last_index * row_verts; 432 CPDF_MeshVertex* last_row = vertex + last_index * row_verts;
433 CPDF_MeshVertex* this_row = vertex + (1 - last_index) * row_verts; 433 CPDF_MeshVertex* this_row = vertex + (1 - last_index) * row_verts;
434 if (!stream.GetVertexRow(this_row, row_verts, pObject2Bitmap)) { 434 if (!stream.GetVertexRow(this_row, row_verts, pObject2Bitmap)) {
435 FX_Free(vertex); 435 FX_Free(vertex);
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 } 1103 }
1104 } 1104 }
1105 if(bStroke) { 1105 if(bStroke) {
1106 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1106 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1107 if(StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1107 if(StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1108 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1108 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1109 bStroke = FALSE; 1109 bStroke = FALSE;
1110 } 1110 }
1111 } 1111 }
1112 } 1112 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp ('k') | core/src/fpdftext/fpdf_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698