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

Side by Side Diff: fpdfsdk/fpdfeditpage.cpp

Issue 2303553002: Make CPDF_GeneralState have a CPDF_GeneralStateData (Closed)
Patch Set: Nit Created 4 years, 3 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 | « fpdfsdk/fpdfeditimg.cpp ('k') | no next file » | 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 "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
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
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 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfeditimg.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698