OLD | NEW |
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/fxcrt/fx_ext.h" | 7 #include "../../../include/fxcrt/fx_ext.h" |
8 #include "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
9 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" | 9 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" |
10 #include "../ge/text_int.h" | 10 #include "../ge/text_int.h" |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 { | 1090 { |
1091 return m_pContext; | 1091 return m_pContext; |
1092 } | 1092 } |
1093 FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, FX_INT32 nDeviceClass) | 1093 FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, FX_INT32 nDeviceClass) |
1094 { | 1094 { |
1095 if (m_pContext) { | 1095 if (m_pContext) { |
1096 CGContextRelease(m_pContext); | 1096 CGContextRelease(m_pContext); |
1097 } | 1097 } |
1098 m_pContext = context; | 1098 m_pContext = context; |
1099 CGContextRetain(m_pContext); | 1099 CGContextRetain(m_pContext); |
1100 IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_QuartzDeviceDriver(m_pContext,
nDeviceClass); | 1100 IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, nDe
viceClass); |
1101 if (!pDriver) { | |
1102 return FALSE; | |
1103 } | |
1104 SetDeviceDriver(pDriver); | 1101 SetDeviceDriver(pDriver); |
1105 return TRUE; | 1102 return TRUE; |
1106 } | 1103 } |
1107 FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) | 1104 FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) |
1108 { | 1105 { |
1109 SetBitmap(pBitmap); | 1106 SetBitmap(pBitmap); |
1110 m_pContext = createContextWithBitmap(pBitmap); | 1107 m_pContext = createContextWithBitmap(pBitmap); |
1111 if (NULL == m_pContext) { | 1108 if (NULL == m_pContext) { |
1112 return FALSE; | 1109 return FALSE; |
1113 } | 1110 } |
1114 IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_QuartzDeviceDriver(m_pContext,
FXDC_DISPLAY); | 1111 IFX_RenderDeviceDriver* pDriver = new CFX_QuartzDeviceDriver(m_pContext, FXD
C_DISPLAY); |
1115 if (!pDriver) { | |
1116 return FALSE; | |
1117 } | |
1118 SetDeviceDriver(pDriver); | 1112 SetDeviceDriver(pDriver); |
1119 return TRUE; | 1113 return TRUE; |
1120 } | 1114 } |
1121 FX_BOOL CFX_QuartzDevice::Create(FX_INT32 width, FX_INT32 height, FXDIB_Format f
ormat) | 1115 FX_BOOL CFX_QuartzDevice::Create(FX_INT32 width, FX_INT32 height, FXDIB_Format f
ormat) |
1122 { | 1116 { |
1123 if ((FX_BYTE)format < 32) { | 1117 if ((FX_BYTE)format < 32) { |
1124 return FALSE; | 1118 return FALSE; |
1125 } | 1119 } |
1126 CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; | 1120 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
1127 if (!pBitmap) { | |
1128 return FALSE; | |
1129 } | |
1130 if (!pBitmap->Create(width, height, format)) { | 1121 if (!pBitmap->Create(width, height, format)) { |
1131 delete pBitmap; | 1122 delete pBitmap; |
1132 return FALSE; | 1123 return FALSE; |
1133 } | 1124 } |
1134 m_bOwnedBitmap = TRUE; | 1125 m_bOwnedBitmap = TRUE; |
1135 return Attach(pBitmap); | 1126 return Attach(pBitmap); |
1136 } | 1127 } |
1137 #endif | 1128 #endif |
OLD | NEW |