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

Side by Side Diff: core/src/fxge/skia/fx_skia_device.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/fxge/dib/fx_dib_engine.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.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 #include "../../../include/fxge/fx_ge.h" 5 #include "../../../include/fxge/fx_ge.h"
6 //#define _SKIA_SUPPORT_ 6 //#define _SKIA_SUPPORT_
7 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 9
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 stroker.setJoin(join); 203 stroker.setJoin(join);
204 stroker.setMiterLimit(pGraphState->m_MiterLimit); 204 stroker.setMiterLimit(pGraphState->m_MiterLimit);
205 stroker.setWidth(width); 205 stroker.setWidth(width);
206 stroker.setDoFill(FALSE); 206 stroker.setDoFill(FALSE);
207 stroker.strokePath(path_data, dstPathData); 207 stroker.strokePath(path_data, dstPathData);
208 SkMatrix smatrix; 208 SkMatrix smatrix;
209 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Dev ice->e, pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, 0, 1); 209 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Dev ice->e, pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, 0, 1);
210 dstPathData->transform(smatrix); 210 dstPathData->transform(smatrix);
211 } else { 211 } else {
212 int count = (pGraphState->m_DashCount+1)/2; 212 int count = (pGraphState->m_DashCount+1)/2;
213 » » SkScalar* intervals = FX_Alloc(SkScalar, count* sizeof (SkScalar )); 213 » » SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScala r));
214 // Set dash pattern 214 // Set dash pattern
215 for (int i = 0; i < count; i ++) { 215 for (int i = 0; i < count; i ++) {
216 FX_FIXFLOAT on = pGraphState->m_DashArray[i*2]; 216 FX_FIXFLOAT on = pGraphState->m_DashArray[i*2];
217 if (on <= 0.000001f) on = FIX8_ONE/10; 217 if (on <= 0.000001f) on = FIX8_ONE/10;
218 FX_FIXFLOAT off = i*2+1 == pGraphState->m_DashCount ? on : 218 FX_FIXFLOAT off = i*2+1 == pGraphState->m_DashCount ? on :
219 pGraphState->m_DashArray[i*2+1]; 219 pGraphState->m_DashArray[i*2+1];
220 if (off < 0) off = 0; 220 if (off < 0) off = 0;
221 intervals[i*2]=on*scale; 221 intervals[i*2]=on*scale;
222 intervals[i*2+1]=off*scale; 222 intervals[i*2+1]=off*scale;
223 } 223 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dithe r_bits, FALSE, pOriDevice, FALSE); 522 CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dithe r_bits, FALSE, pOriDevice, FALSE);
523 SetDeviceDriver(pDriver); 523 SetDeviceDriver(pDriver);
524 return TRUE; 524 return TRUE;
525 } 525 }
526 CFX_SkiaDevice::~CFX_SkiaDevice() 526 CFX_SkiaDevice::~CFX_SkiaDevice()
527 { 527 {
528 if (m_bOwnedBitmap && GetBitmap()) delete GetBitmap(); 528 if (m_bOwnedBitmap && GetBitmap()) delete GetBitmap();
529 } 529 }
530 530
531 #endif 531 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/dib/fx_dib_engine.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698