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

Side by Side Diff: core/src/fxge/skia/fx_skia_device.cpp

Issue 1062863006: Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing |new| typo. Created 5 years, 8 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_transform.cpp ('k') | core/src/fxge/win32/fx_win32_device.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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 spaint.getFillPath(path_data, dstPathData); 230 spaint.getFillPath(path_data, dstPathData);
231 SkMatrix smatrix; 231 SkMatrix smatrix;
232 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Dev ice->e, pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, 0, 1); 232 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Dev ice->e, pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, 0, 1);
233 dstPathData->transform(smatrix); 233 dstPathData->transform(smatrix);
234 FX_Free(intervals); 234 FX_Free(intervals);
235 } 235 }
236 } 236 }
237 237
238 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bit s, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) 238 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bit s, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout)
239 { 239 {
240 » m_pAggDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByte Order, pOriDevice, bGroupKnockout); 240 » m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrd er, pOriDevice, bGroupKnockout);
241 } 241 }
242 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() 242 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver()
243 { 243 {
244 if (m_pAggDriver) delete m_pAggDriver; 244 if (m_pAggDriver) delete m_pAggDriver;
245 } 245 }
246 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* p CharPos, CFX_Font* pFont, 246 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* p CharPos, CFX_Font* pFont,
247 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, F X_FIXFLOAT font_size, FX_DWORD color, 247 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, F X_FIXFLOAT font_size, FX_DWORD color,
248 int alpha_flag, void* pIccTransform) 248 int alpha_flag, void* pIccTransform)
249 { 249 {
250 return m_pAggDriver->DrawDeviceText(nChars, pCharPos, pFont,pCache, pObj ect2Device, font_size, color, 250 return m_pAggDriver->DrawDeviceText(nChars, pCharPos, pFont,pCache, pObj ect2Device, font_size, color,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Finally, we have got the mask that we need, intersect with current cl ip region 293 // Finally, we have got the mask that we need, intersect with current cl ip region
294 m_pAggDriver->m_pClipRgn->IntersectMaskF(clip_box.fLeft, clip_box.fTop, mask); 294 m_pAggDriver->m_pClipRgn->IntersectMaskF(clip_box.fLeft, clip_box.fTop, mask);
295 295
296 } 296 }
297 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // path info 297 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, // path info
298 const CFX_AffineMatrix* pObject2 Device, // optional transformation 298 const CFX_AffineMatrix* pObject2 Device, // optional transformation
299 int fill_mode // fill mode, WI NDING or ALTERNATE 299 int fill_mode // fill mode, WI NDING or ALTERNATE
300 ) 300 )
301 { 301 {
302 if (m_pAggDriver->m_pClipRgn == NULL) 302 if (m_pAggDriver->m_pClipRgn == NULL)
303 » » m_pAggDriver->m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC _PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 303 » » m_pAggDriver->m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PI XEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
304 304
305 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { 305 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
306 CFX_FloatRect rectf; 306 CFX_FloatRect rectf;
307 if (pPathData->IsRect(pObject2Device, &rectf)) { 307 if (pPathData->IsRect(pObject2Device, &rectf)) {
308 rectf.Intersect(CFX_FloatRect(0, 0, (FX_FIXFLOAT)GetDevi ceCaps(FXDC_PIXEL_WIDTH), (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 308 rectf.Intersect(CFX_FloatRect(0, 0, (FX_FIXFLOAT)GetDevi ceCaps(FXDC_PIXEL_WIDTH), (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
309 FX_RECT rect = rectf.GetOutterRect(); 309 FX_RECT rect = rectf.GetOutterRect();
310 m_pAggDriver->m_pClipRgn->IntersectRect(rect); 310 m_pAggDriver->m_pClipRgn->IntersectRect(rect);
311 return TRUE; 311 return TRUE;
312 } 312 }
313 } 313 }
(...skipping 11 matching lines...) Expand all
325 325
326 return TRUE; 326 return TRUE;
327 } 327 }
328 328
329 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, // path info 329 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, // path info
330 const CFX_AffineMatrix* pObject2 Device, // optional transformation 330 const CFX_AffineMatrix* pObject2 Device, // optional transformation
331 const CFX_GraphStateData* pGraph State // graphic state, for pen attributes 331 const CFX_GraphStateData* pGraph State // graphic state, for pen attributes
332 ) 332 )
333 { 333 {
334 if (m_pAggDriver->m_pClipRgn == NULL) 334 if (m_pAggDriver->m_pClipRgn == NULL)
335 » » m_pAggDriver->m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC _PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 335 » » m_pAggDriver->m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PI XEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
336 336
337 // build path data 337 // build path data
338 CSkia_PathData path_data; 338 CSkia_PathData path_data;
339 path_data.BuildPath(pPathData, NULL); 339 path_data.BuildPath(pPathData, NULL);
340 path_data.m_PathData.setFillType(SkPath::kWinding_FillType); 340 path_data.m_PathData.setFillType(SkPath::kWinding_FillType);
341 341
342 SkPaint spaint; 342 SkPaint spaint;
343 spaint.setColor(0xffffffff); 343 spaint.setColor(0xffffffff);
344 spaint.setStyle(SkPaint::kStroke_Style); 344 spaint.setStyle(SkPaint::kStroke_Style);
345 spaint.setAntiAlias(TRUE); 345 spaint.setAntiAlias(TRUE);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 CFX_SkiaDevice::CFX_SkiaDevice() 498 CFX_SkiaDevice::CFX_SkiaDevice()
499 { 499 {
500 m_bOwnedBitmap = FALSE; 500 m_bOwnedBitmap = FALSE;
501 } 501 }
502 502
503 FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b RgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) 503 FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b RgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout)
504 { 504 {
505 if (pBitmap == NULL) 505 if (pBitmap == NULL)
506 return FALSE; 506 return FALSE;
507 SetBitmap(pBitmap); 507 SetBitmap(pBitmap);
508 » CFX_SkiaDeviceDriver* pDriver = FX_NEW CFX_SkiaDeviceDriver(pBitmap, dit her_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); 508 » CFX_SkiaDeviceDriver* pDriver = new CFX_SkiaDeviceDriver(pBitmap, dither _bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
509 SetDeviceDriver(pDriver); 509 SetDeviceDriver(pDriver);
510 return TRUE; 510 return TRUE;
511 } 511 }
512 512
513 FX_BOOL CFX_SkiaDevice::Create(int width, int height, FXDIB_Format format, int d ither_bits, CFX_DIBitmap* pOriDevice) 513 FX_BOOL CFX_SkiaDevice::Create(int width, int height, FXDIB_Format format, int d ither_bits, CFX_DIBitmap* pOriDevice)
514 { 514 {
515 m_bOwnedBitmap = TRUE; 515 m_bOwnedBitmap = TRUE;
516 » CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; 516 » CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
517 if (!pBitmap->Create(width, height, format)) { 517 if (!pBitmap->Create(width, height, format)) {
518 delete pBitmap; 518 delete pBitmap;
519 return FALSE; 519 return FALSE;
520 } 520 }
521 SetBitmap(pBitmap); 521 SetBitmap(pBitmap);
522 » CFX_SkiaDeviceDriver* pDriver = FX_NEW CFX_SkiaDeviceDriver(pBitmap, di ther_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_transform.cpp ('k') | core/src/fxge/win32/fx_win32_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698