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 "public/fpdf_edit.h" | 7 #include "public/fpdf_edit.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 215 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
216 return pPage && pPage->BackgroundAlphaNeeded(); | 216 return pPage && pPage->BackgroundAlphaNeeded(); |
217 } | 217 } |
218 | 218 |
219 DLLEXPORT FPDF_BOOL STDCALL | 219 DLLEXPORT FPDF_BOOL STDCALL |
220 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { | 220 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { |
221 if (!pageObject) | 221 if (!pageObject) |
222 return FALSE; | 222 return FALSE; |
223 | 223 |
224 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject); | 224 CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(pageObject); |
225 const CPDF_GeneralStateData* pGeneralState = | 225 int blend_type = pPageObj->m_GeneralState.GetBlendType(); |
226 pPageObj->m_GeneralState.GetObject(); | |
227 int blend_type = | |
228 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL; | |
229 if (blend_type != FXDIB_BLEND_NORMAL) | 226 if (blend_type != FXDIB_BLEND_NORMAL) |
230 return TRUE; | 227 return TRUE; |
231 | 228 |
232 CPDF_Dictionary* pSMaskDict = | 229 CPDF_Dictionary* pSMaskDict = |
233 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : nullptr; | 230 ToDictionary(pPageObj->m_GeneralState.GetSoftMask()); |
234 if (pSMaskDict) | 231 if (pSMaskDict) |
235 return TRUE; | 232 return TRUE; |
236 | 233 |
237 if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f) | 234 if (pPageObj->m_GeneralState.GetFillAlpha() != 1.0f) |
238 return TRUE; | 235 return TRUE; |
239 | 236 |
240 if (pPageObj->IsPath() && pGeneralState && | 237 if (pPageObj->IsPath() && pPageObj->m_GeneralState.GetStrokeAlpha() != 1.0f) { |
241 pGeneralState->m_StrokeAlpha != 1.0f) { | |
242 return TRUE; | 238 return TRUE; |
243 } | 239 } |
244 | 240 |
245 if (pPageObj->IsForm()) { | 241 if (pPageObj->IsForm()) { |
246 const CPDF_Form* pForm = pPageObj->AsForm()->form(); | 242 const CPDF_Form* pForm = pPageObj->AsForm()->form(); |
247 if (pForm) { | 243 if (pForm) { |
248 int trans = pForm->m_Transparency; | 244 int trans = pForm->m_Transparency; |
249 if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) | 245 if ((trans & PDFTRANS_ISOLATED) || (trans & PDFTRANS_GROUP)) |
250 return TRUE; | 246 return TRUE; |
251 } | 247 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 311 |
316 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { | 312 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { |
317 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 313 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
318 if (!IsPageObject(pPage)) | 314 if (!IsPageObject(pPage)) |
319 return; | 315 return; |
320 | 316 |
321 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 317 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
322 rotate %= 4; | 318 rotate %= 4; |
323 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 319 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
324 } | 320 } |
OLD | NEW |