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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render.cpp

Issue 1519693002: Merge to XFA: Remove CFX_AffineMatrix/CPDF_Matrix (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: XFA-specific changes Created 5 years 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
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 "render_int.h" 7 #include "render_int.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_render.h" 10 #include "core/include/fpdfapi/fpdf_render.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 m_bLoadMask(FALSE), 174 m_bLoadMask(FALSE),
175 m_pType3Char(nullptr), 175 m_pType3Char(nullptr),
176 m_T3FillColor(0), 176 m_T3FillColor(0),
177 m_curBlend(FXDIB_BLEND_NORMAL) {} 177 m_curBlend(FXDIB_BLEND_NORMAL) {}
178 178
179 CPDF_RenderStatus::~CPDF_RenderStatus() { 179 CPDF_RenderStatus::~CPDF_RenderStatus() {
180 } 180 }
181 181
182 FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, 182 FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
183 CFX_RenderDevice* pDevice, 183 CFX_RenderDevice* pDevice,
184 const CFX_AffineMatrix* pDeviceMatrix, 184 const CFX_Matrix* pDeviceMatrix,
185 const CPDF_PageObject* pStopObj, 185 const CPDF_PageObject* pStopObj,
186 const CPDF_RenderStatus* pParentState, 186 const CPDF_RenderStatus* pParentState,
187 const CPDF_GraphicStates* pInitialStates, 187 const CPDF_GraphicStates* pInitialStates,
188 const CPDF_RenderOptions* pOptions, 188 const CPDF_RenderOptions* pOptions,
189 int transparency, 189 int transparency,
190 FX_BOOL bDropObjects, 190 FX_BOOL bDropObjects,
191 CPDF_Dictionary* pFormResource, 191 CPDF_Dictionary* pFormResource,
192 FX_BOOL bStdCS, 192 FX_BOOL bStdCS,
193 CPDF_Type3Char* pType3Char, 193 CPDF_Type3Char* pType3Char,
194 FX_ARGB fill_color, 194 FX_ARGB fill_color,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 234 }
235 } 235 }
236 } else { 236 } else {
237 m_InitialStates.DefaultStates(); 237 m_InitialStates.DefaultStates();
238 } 238 }
239 m_pObjectRenderer.reset(); 239 m_pObjectRenderer.reset();
240 m_Transparency = transparency; 240 m_Transparency = transparency;
241 return TRUE; 241 return TRUE;
242 } 242 }
243 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs, 243 void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs,
244 const CFX_AffineMatrix* pObj2Device) { 244 const CFX_Matrix* pObj2Device) {
245 CFX_FloatRect clip_rect = m_pDevice->GetClipBox(); 245 CFX_FloatRect clip_rect = m_pDevice->GetClipBox();
246 CFX_AffineMatrix device2object; 246 CFX_Matrix device2object;
247 device2object.SetReverse(*pObj2Device); 247 device2object.SetReverse(*pObj2Device);
248 device2object.TransformRect(clip_rect); 248 device2object.TransformRect(clip_rect);
249 int index = 0; 249 int index = 0;
250 FX_POSITION pos = pObjs->GetFirstObjectPosition(); 250 FX_POSITION pos = pObjs->GetFirstObjectPosition();
251 while (pos) { 251 while (pos) {
252 index++; 252 index++;
253 CPDF_PageObject* pCurObj = pObjs->GetNextObject(pos); 253 CPDF_PageObject* pCurObj = pObjs->GetNextObject(pos);
254 if (pCurObj == m_pStopObj) { 254 if (pCurObj == m_pStopObj) {
255 m_bStopped = TRUE; 255 m_bStopped = TRUE;
256 return; 256 return;
257 } 257 }
258 if (!pCurObj) { 258 if (!pCurObj) {
259 continue; 259 continue;
260 } 260 }
261 if (pCurObj == NULL || pCurObj->m_Left > clip_rect.right || 261 if (pCurObj == NULL || pCurObj->m_Left > clip_rect.right ||
262 pCurObj->m_Right < clip_rect.left || 262 pCurObj->m_Right < clip_rect.left ||
263 pCurObj->m_Bottom > clip_rect.top || 263 pCurObj->m_Bottom > clip_rect.top ||
264 pCurObj->m_Top < clip_rect.bottom) { 264 pCurObj->m_Top < clip_rect.bottom) {
265 continue; 265 continue;
266 } 266 }
267 RenderSingleObject(pCurObj, pObj2Device); 267 RenderSingleObject(pCurObj, pObj2Device);
268 if (m_bStopped) { 268 if (m_bStopped) {
269 return; 269 return;
270 } 270 }
271 } 271 }
272 } 272 }
273 void CPDF_RenderStatus::RenderSingleObject( 273 void CPDF_RenderStatus::RenderSingleObject(const CPDF_PageObject* pObj,
274 const CPDF_PageObject* pObj, 274 const CFX_Matrix* pObj2Device) {
275 const CFX_AffineMatrix* pObj2Device) {
276 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); 275 CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
277 if (++s_CurrentRecursionDepth > kRenderMaxRecursionDepth) { 276 if (++s_CurrentRecursionDepth > kRenderMaxRecursionDepth) {
278 return; 277 return;
279 } 278 }
280 m_pCurObj = pObj; 279 m_pCurObj = pObj;
281 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) { 280 if (m_Options.m_pOCContext && pObj->m_ContentMark.NotNull()) {
282 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) { 281 if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
283 return; 282 return;
284 } 283 }
285 } 284 }
286 ProcessClipPath(pObj->m_ClipPath, pObj2Device); 285 ProcessClipPath(pObj->m_ClipPath, pObj2Device);
287 if (ProcessTransparency(pObj, pObj2Device)) { 286 if (ProcessTransparency(pObj, pObj2Device)) {
288 return; 287 return;
289 } 288 }
290 ProcessObjectNoClip(pObj, pObj2Device); 289 ProcessObjectNoClip(pObj, pObj2Device);
291 } 290 }
292 291
293 FX_BOOL CPDF_RenderStatus::ContinueSingleObject( 292 FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj,
294 const CPDF_PageObject* pObj, 293 const CFX_Matrix* pObj2Device,
295 const CFX_AffineMatrix* pObj2Device, 294 IFX_Pause* pPause) {
296 IFX_Pause* pPause) {
297 if (m_pObjectRenderer) { 295 if (m_pObjectRenderer) {
298 if (m_pObjectRenderer->Continue(pPause)) 296 if (m_pObjectRenderer->Continue(pPause))
299 return TRUE; 297 return TRUE;
300 298
301 if (!m_pObjectRenderer->m_Result) 299 if (!m_pObjectRenderer->m_Result)
302 DrawObjWithBackground(pObj, pObj2Device); 300 DrawObjWithBackground(pObj, pObj2Device);
303 m_pObjectRenderer.reset(); 301 m_pObjectRenderer.reset();
304 return FALSE; 302 return FALSE;
305 } 303 }
306 304
(...skipping 21 matching lines...) Expand all
328 ProcessObjectNoClip(pObj, pObj2Device); 326 ProcessObjectNoClip(pObj, pObj2Device);
329 return FALSE; 327 return FALSE;
330 } 328 }
331 329
332 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) { 330 IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) {
333 if (type != PDFPAGE_IMAGE) { 331 if (type != PDFPAGE_IMAGE) {
334 return NULL; 332 return NULL;
335 } 333 }
336 return new CPDF_ImageRenderer; 334 return new CPDF_ImageRenderer;
337 } 335 }
338 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect( 336 FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
339 const CPDF_PageObject* pObj, 337 const CFX_Matrix* pObj2Device,
340 const CFX_AffineMatrix* pObj2Device, 338 FX_BOOL bLogical,
341 FX_BOOL bLogical, 339 FX_RECT& rect) const {
342 FX_RECT& rect) const {
343 rect = pObj->GetBBox(pObj2Device); 340 rect = pObj->GetBBox(pObj2Device);
344 FX_RECT rtClip = m_pDevice->GetClipBox(); 341 FX_RECT rtClip = m_pDevice->GetClipBox();
345 if (!bLogical) { 342 if (!bLogical) {
346 CFX_Matrix dCTM = m_pDevice->GetCTM(); 343 CFX_Matrix dCTM = m_pDevice->GetCTM();
347 FX_FLOAT a = FXSYS_fabs(dCTM.a); 344 FX_FLOAT a = FXSYS_fabs(dCTM.a);
348 FX_FLOAT d = FXSYS_fabs(dCTM.d); 345 FX_FLOAT d = FXSYS_fabs(dCTM.d);
349 if (a != 1.0f || d != 1.0f) { 346 if (a != 1.0f || d != 1.0f) {
350 rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a); 347 rect.right = rect.left + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Width() * a);
351 rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d); 348 rect.bottom = rect.top + (int32_t)FXSYS_ceil((FX_FLOAT)rect.Height() * d);
352 rtClip.right = 349 rtClip.right =
353 rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a); 350 rtClip.left + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Width() * a);
354 rtClip.bottom = 351 rtClip.bottom =
355 rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d); 352 rtClip.top + (int32_t)FXSYS_ceil((FX_FLOAT)rtClip.Height() * d);
356 } 353 }
357 } 354 }
358 rect.Intersect(rtClip); 355 rect.Intersect(rtClip);
359 return rect.IsEmpty(); 356 return rect.IsEmpty();
360 } 357 }
361 void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj, 358 void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj,
362 const CFX_AffineMatrix* pObj2Device) { 359 const CFX_Matrix* pObj2Device) {
363 CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap(); 360 CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap();
364 if (pBitmap == NULL) { 361 if (pBitmap == NULL) {
365 return; 362 return;
366 } 363 }
367 FX_RECT rect; 364 FX_RECT rect;
368 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { 365 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
369 return; 366 return;
370 } 367 }
371 if (m_DitherBits == 2) { 368 if (m_DitherBits == 2) {
372 static FX_ARGB pal[4] = {0, 85, 170, 255}; 369 static FX_ARGB pal[4] = {0, 85, 170, 255};
373 pBitmap->DitherFS(pal, 4, &rect); 370 pBitmap->DitherFS(pal, 4, &rect);
374 } else if (m_DitherBits == 3) { 371 } else if (m_DitherBits == 3) {
375 static FX_ARGB pal[8] = {0, 36, 73, 109, 146, 182, 219, 255}; 372 static FX_ARGB pal[8] = {0, 36, 73, 109, 146, 182, 219, 255};
376 pBitmap->DitherFS(pal, 8, &rect); 373 pBitmap->DitherFS(pal, 8, &rect);
377 } else if (m_DitherBits == 4) { 374 } else if (m_DitherBits == 4) {
378 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119, 375 static FX_ARGB pal[16] = {0, 17, 34, 51, 68, 85, 102, 119,
379 136, 153, 170, 187, 204, 221, 238, 255}; 376 136, 153, 170, 187, 204, 221, 238, 255};
380 pBitmap->DitherFS(pal, 16, &rect); 377 pBitmap->DitherFS(pal, 16, &rect);
381 } 378 }
382 } 379 }
383 void CPDF_RenderStatus::ProcessObjectNoClip( 380 void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj,
384 const CPDF_PageObject* pObj, 381 const CFX_Matrix* pObj2Device) {
385 const CFX_AffineMatrix* pObj2Device) {
386 FX_BOOL bRet = FALSE; 382 FX_BOOL bRet = FALSE;
387 switch (pObj->m_Type) { 383 switch (pObj->m_Type) {
388 case PDFPAGE_TEXT: 384 case PDFPAGE_TEXT:
389 bRet = ProcessText((CPDF_TextObject*)pObj, pObj2Device, NULL); 385 bRet = ProcessText((CPDF_TextObject*)pObj, pObj2Device, NULL);
390 break; 386 break;
391 case PDFPAGE_PATH: 387 case PDFPAGE_PATH:
392 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); 388 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device);
393 break; 389 break;
394 case PDFPAGE_IMAGE: 390 case PDFPAGE_IMAGE:
395 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); 391 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device);
396 break; 392 break;
397 case PDFPAGE_SHADING: 393 case PDFPAGE_SHADING:
398 bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device); 394 bRet = ProcessShading((CPDF_ShadingObject*)pObj, pObj2Device);
399 break; 395 break;
400 case PDFPAGE_FORM: 396 case PDFPAGE_FORM:
401 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); 397 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device);
402 break; 398 break;
403 } 399 }
404 if (!bRet) { 400 if (!bRet) {
405 DrawObjWithBackground(pObj, pObj2Device); 401 DrawObjWithBackground(pObj, pObj2Device);
406 } 402 }
407 } 403 }
408 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend( 404 FX_BOOL CPDF_RenderStatus::DrawObjWithBlend(const CPDF_PageObject* pObj,
409 const CPDF_PageObject* pObj, 405 const CFX_Matrix* pObj2Device) {
410 const CFX_AffineMatrix* pObj2Device) {
411 FX_BOOL bRet = FALSE; 406 FX_BOOL bRet = FALSE;
412 switch (pObj->m_Type) { 407 switch (pObj->m_Type) {
413 case PDFPAGE_PATH: 408 case PDFPAGE_PATH:
414 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device); 409 bRet = ProcessPath((CPDF_PathObject*)pObj, pObj2Device);
415 break; 410 break;
416 case PDFPAGE_IMAGE: 411 case PDFPAGE_IMAGE:
417 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device); 412 bRet = ProcessImage((CPDF_ImageObject*)pObj, pObj2Device);
418 break; 413 break;
419 case PDFPAGE_FORM: 414 case PDFPAGE_FORM:
420 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); 415 bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device);
421 break; 416 break;
422 } 417 }
423 return bRet; 418 return bRet;
424 } 419 }
425 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { 420 void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const {
426 CFX_Matrix dCTM = m_pDevice->GetCTM(); 421 CFX_Matrix dCTM = m_pDevice->GetCTM();
427 matrix.a *= FXSYS_fabs(dCTM.a); 422 matrix.a *= FXSYS_fabs(dCTM.a);
428 matrix.d *= FXSYS_fabs(dCTM.d); 423 matrix.d *= FXSYS_fabs(dCTM.d);
429 } 424 }
430 void CPDF_RenderStatus::DrawObjWithBackground( 425 void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj,
431 const CPDF_PageObject* pObj, 426 const CFX_Matrix* pObj2Device) {
432 const CFX_AffineMatrix* pObj2Device) {
433 FX_RECT rect; 427 FX_RECT rect;
434 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { 428 if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) {
435 return; 429 return;
436 } 430 }
437 int res = 300; 431 int res = 300;
438 if (pObj->m_Type == PDFPAGE_IMAGE && 432 if (pObj->m_Type == PDFPAGE_IMAGE &&
439 m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { 433 m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
440 res = 0; 434 res = 0;
441 } 435 }
442 CPDF_ScaledRenderBuffer buffer; 436 CPDF_ScaledRenderBuffer buffer;
443 if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res)) { 437 if (!buffer.Initialize(m_pContext, m_pDevice, &rect, pObj, &m_Options, res)) {
444 return; 438 return;
445 } 439 }
446 CFX_AffineMatrix matrix = *pObj2Device; 440 CFX_Matrix matrix = *pObj2Device;
447 matrix.Concat(*buffer.GetMatrix()); 441 matrix.Concat(*buffer.GetMatrix());
448 GetScaledMatrix(matrix); 442 GetScaledMatrix(matrix);
449 CPDF_Dictionary* pFormResource = NULL; 443 CPDF_Dictionary* pFormResource = NULL;
450 if (pObj->m_Type == PDFPAGE_FORM) { 444 if (pObj->m_Type == PDFPAGE_FORM) {
451 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; 445 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj;
452 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { 446 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) {
453 pFormResource = 447 pFormResource =
454 pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources")); 448 pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
455 } 449 }
456 } 450 }
457 CPDF_RenderStatus status; 451 CPDF_RenderStatus status;
458 status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, 452 status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL,
459 NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, 453 NULL, NULL, &m_Options, m_Transparency, m_bDropObjects,
460 pFormResource); 454 pFormResource);
461 status.RenderSingleObject(pObj, &matrix); 455 status.RenderSingleObject(pObj, &matrix);
462 buffer.OutputToDevice(); 456 buffer.OutputToDevice();
463 } 457 }
464 FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, 458 FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj,
465 const CFX_AffineMatrix* pObj2Device) { 459 const CFX_Matrix* pObj2Device) {
466 CPDF_Dictionary* pOC = 460 CPDF_Dictionary* pOC =
467 pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC")); 461 pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC"));
468 if (pOC && m_Options.m_pOCContext && 462 if (pOC && m_Options.m_pOCContext &&
469 !m_Options.m_pOCContext->CheckOCGVisible(pOC)) { 463 !m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
470 return TRUE; 464 return TRUE;
471 } 465 }
472 CFX_AffineMatrix matrix = pFormObj->m_FormMatrix; 466 CFX_Matrix matrix = pFormObj->m_FormMatrix;
473 matrix.Concat(*pObj2Device); 467 matrix.Concat(*pObj2Device);
474 CPDF_Dictionary* pResources = NULL; 468 CPDF_Dictionary* pResources = NULL;
475 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { 469 if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) {
476 pResources = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources")); 470 pResources = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
477 } 471 }
478 CPDF_RenderStatus status; 472 CPDF_RenderStatus status;
479 status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, 473 status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj,
480 &m_Options, m_Transparency, m_bDropObjects, pResources, 474 &m_Options, m_Transparency, m_bDropObjects, pResources,
481 FALSE); 475 FALSE);
482 status.m_curBlend = m_curBlend; 476 status.m_curBlend = m_curBlend;
483 m_pDevice->SaveState(); 477 m_pDevice->SaveState();
484 status.RenderObjectList(pFormObj->m_pForm, &matrix); 478 status.RenderObjectList(pFormObj->m_pForm, &matrix);
485 m_bStopped = status.m_bStopped; 479 m_bStopped = status.m_bStopped;
486 m_pDevice->RestoreState(); 480 m_pDevice->RestoreState();
487 return TRUE; 481 return TRUE;
488 } 482 }
489 FX_BOOL IsAvailableMatrix(const CFX_AffineMatrix& matrix) { 483 FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) {
490 if (matrix.a == 0 || matrix.d == 0) { 484 if (matrix.a == 0 || matrix.d == 0) {
491 return matrix.b != 0 && matrix.c != 0; 485 return matrix.b != 0 && matrix.c != 0;
492 } 486 }
493 if (matrix.b == 0 || matrix.c == 0) { 487 if (matrix.b == 0 || matrix.c == 0) {
494 return matrix.a != 0 && matrix.d != 0; 488 return matrix.a != 0 && matrix.d != 0;
495 } 489 }
496 return TRUE; 490 return TRUE;
497 } 491 }
498 FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, 492 FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
499 const CFX_AffineMatrix* pObj2Device) { 493 const CFX_Matrix* pObj2Device) {
500 int FillType = pPathObj->m_FillType; 494 int FillType = pPathObj->m_FillType;
501 FX_BOOL bStroke = pPathObj->m_bStroke; 495 FX_BOOL bStroke = pPathObj->m_bStroke;
502 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke); 496 ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke);
503 if (FillType == 0 && !bStroke) { 497 if (FillType == 0 && !bStroke) {
504 return TRUE; 498 return TRUE;
505 } 499 }
506 FX_DWORD fill_argb = 0; 500 FX_DWORD fill_argb = 0;
507 if (FillType) { 501 if (FillType) {
508 fill_argb = GetFillArgb(pPathObj); 502 fill_argb = GetFillArgb(pPathObj);
509 } 503 }
510 FX_DWORD stroke_argb = 0; 504 FX_DWORD stroke_argb = 0;
511 if (bStroke) { 505 if (bStroke) {
512 stroke_argb = GetStrokeArgb(pPathObj); 506 stroke_argb = GetStrokeArgb(pPathObj);
513 } 507 }
514 CFX_AffineMatrix path_matrix = pPathObj->m_Matrix; 508 CFX_Matrix path_matrix = pPathObj->m_Matrix;
515 path_matrix.Concat(*pObj2Device); 509 path_matrix.Concat(*pObj2Device);
516 if (!IsAvailableMatrix(path_matrix)) { 510 if (!IsAvailableMatrix(path_matrix)) {
517 return TRUE; 511 return TRUE;
518 } 512 }
519 if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) { 513 if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) {
520 FillType |= FXFILL_RECT_AA; 514 FillType |= FXFILL_RECT_AA;
521 } 515 }
522 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) { 516 if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) {
523 FillType |= FXFILL_FULLCOVER; 517 FillType |= FXFILL_FULLCOVER;
524 } 518 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 if (pGeneralData->m_pTransferFunc) { 610 if (pGeneralData->m_pTransferFunc) {
617 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); 611 rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb);
618 } 612 }
619 } 613 }
620 } else { 614 } else {
621 alpha = 255; 615 alpha = 255;
622 } 616 }
623 return m_Options.TranslateColor(ArgbEncode(alpha, rgb)); 617 return m_Options.TranslateColor(ArgbEncode(alpha, rgb));
624 } 618 }
625 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, 619 void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath,
626 const CFX_AffineMatrix* pObj2Device) { 620 const CFX_Matrix* pObj2Device) {
627 if (ClipPath.IsNull()) { 621 if (ClipPath.IsNull()) {
628 if (!m_LastClipPath.IsNull()) { 622 if (!m_LastClipPath.IsNull()) {
629 m_pDevice->RestoreState(TRUE); 623 m_pDevice->RestoreState(TRUE);
630 m_LastClipPath.SetNull(); 624 m_LastClipPath.SetNull();
631 } 625 }
632 return; 626 return;
633 } 627 }
634 if (m_LastClipPath == ClipPath) 628 if (m_LastClipPath == ClipPath)
635 return; 629 return;
636 630
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 670
677 int fill_mode = FXFILL_WINDING; 671 int fill_mode = FXFILL_WINDING;
678 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) 672 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH)
679 fill_mode |= FXFILL_NOPATHSMOOTH; 673 fill_mode |= FXFILL_NOPATHSMOOTH;
680 m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode); 674 m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode);
681 pTextClippingPath.reset(); 675 pTextClippingPath.reset();
682 } 676 }
683 } 677 }
684 678
685 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath, 679 void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath,
686 const CFX_AffineMatrix* pObj2Device) { 680 const CFX_Matrix* pObj2Device) {
687 if (ClipPath.IsNull()) { 681 if (ClipPath.IsNull()) {
688 return; 682 return;
689 } 683 }
690 int fill_mode = 0; 684 int fill_mode = 0;
691 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { 685 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) {
692 fill_mode |= FXFILL_NOPATHSMOOTH; 686 fill_mode |= FXFILL_NOPATHSMOOTH;
693 } 687 }
694 int nClipPath = ClipPath.GetPathCount(); 688 int nClipPath = ClipPath.GetPathCount();
695 int i; 689 int i;
696 for (i = 0; i < nClipPath; i++) { 690 for (i = 0; i < nClipPath; i++) {
697 const CFX_PathData* pPathData = ClipPath.GetPath(i); 691 const CFX_PathData* pPathData = ClipPath.GetPath(i);
698 if (pPathData == NULL) { 692 if (pPathData == NULL) {
699 continue; 693 continue;
700 } 694 }
701 CFX_GraphStateData stroke_state; 695 CFX_GraphStateData stroke_state;
702 if (m_Options.m_Flags & RENDER_THINLINE) { 696 if (m_Options.m_Flags & RENDER_THINLINE) {
703 stroke_state.m_LineWidth = 0; 697 stroke_state.m_LineWidth = 0;
704 } 698 }
705 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000, 699 m_pDevice->DrawPath(pPathData, pObj2Device, &stroke_state, 0, 0xffff0000,
706 fill_mode); 700 fill_mode);
707 } 701 }
708 } 702 }
709 FX_BOOL CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj, 703 FX_BOOL CPDF_RenderStatus::SelectClipPath(CPDF_PathObject* pPathObj,
710 const CFX_AffineMatrix* pObj2Device, 704 const CFX_Matrix* pObj2Device,
711 FX_BOOL bStroke) { 705 FX_BOOL bStroke) {
712 CFX_AffineMatrix path_matrix = pPathObj->m_Matrix; 706 CFX_Matrix path_matrix = pPathObj->m_Matrix;
713 path_matrix.Concat(*pObj2Device); 707 path_matrix.Concat(*pObj2Device);
714 if (bStroke) { 708 if (bStroke) {
715 CFX_GraphStateData graphState(*pPathObj->m_GraphState); 709 CFX_GraphStateData graphState(*pPathObj->m_GraphState);
716 if (m_Options.m_Flags & RENDER_THINLINE) { 710 if (m_Options.m_Flags & RENDER_THINLINE) {
717 graphState.m_LineWidth = 0; 711 graphState.m_LineWidth = 0;
718 } 712 }
719 return m_pDevice->SetClip_PathStroke(pPathObj->m_Path, &path_matrix, 713 return m_pDevice->SetClip_PathStroke(pPathObj->m_Path, &path_matrix,
720 &graphState); 714 &graphState);
721 } 715 }
722 int fill_mode = pPathObj->m_FillType; 716 int fill_mode = pPathObj->m_FillType;
723 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) { 717 if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) {
724 fill_mode |= FXFILL_NOPATHSMOOTH; 718 fill_mode |= FXFILL_NOPATHSMOOTH;
725 } 719 }
726 return m_pDevice->SetClip_PathFill(pPathObj->m_Path, &path_matrix, fill_mode); 720 return m_pDevice->SetClip_PathFill(pPathObj->m_Path, &path_matrix, fill_mode);
727 } 721 }
728 FX_BOOL CPDF_RenderStatus::ProcessTransparency( 722 FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
729 const CPDF_PageObject* pPageObj, 723 const CFX_Matrix* pObj2Device) {
730 const CFX_AffineMatrix* pObj2Device) {
731 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState; 724 const CPDF_GeneralStateData* pGeneralState = pPageObj->m_GeneralState;
732 int blend_type = 725 int blend_type =
733 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL; 726 pGeneralState ? pGeneralState->m_BlendType : FXDIB_BLEND_NORMAL;
734 if (blend_type == FXDIB_BLEND_UNSUPPORTED) { 727 if (blend_type == FXDIB_BLEND_UNSUPPORTED) {
735 return TRUE; 728 return TRUE;
736 } 729 }
737 CPDF_Dictionary* pSMaskDict = 730 CPDF_Dictionary* pSMaskDict =
738 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; 731 pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL;
739 if (pSMaskDict) { 732 if (pSMaskDict) {
740 if (pPageObj->m_Type == PDFPAGE_IMAGE && 733 if (pPageObj->m_Type == PDFPAGE_IMAGE &&
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height)) 824 if (!m_pDevice->CreateCompatibleBitmap(oriDevice.get(), width, height))
832 return TRUE; 825 return TRUE;
833 826
834 m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top); 827 m_pDevice->GetDIBits(oriDevice.get(), rect.left, rect.top);
835 } 828 }
836 if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice.get())) 829 if (!bitmap_device.Create(width, height, FXDIB_Argb, 0, oriDevice.get()))
837 return TRUE; 830 return TRUE;
838 831
839 CFX_DIBitmap* bitmap = bitmap_device.GetBitmap(); 832 CFX_DIBitmap* bitmap = bitmap_device.GetBitmap();
840 bitmap->Clear(0); 833 bitmap->Clear(0);
841 CFX_AffineMatrix new_matrix = *pObj2Device; 834 CFX_Matrix new_matrix = *pObj2Device;
842 new_matrix.TranslateI(-rect.left, -rect.top); 835 new_matrix.TranslateI(-rect.left, -rect.top);
843 new_matrix.Scale(scaleX, scaleY); 836 new_matrix.Scale(scaleX, scaleY);
844 nonstd::unique_ptr<CFX_DIBitmap> pTextMask; 837 nonstd::unique_ptr<CFX_DIBitmap> pTextMask;
845 if (bTextClip) { 838 if (bTextClip) {
846 pTextMask.reset(new CFX_DIBitmap); 839 pTextMask.reset(new CFX_DIBitmap);
847 if (!pTextMask->Create(width, height, FXDIB_8bppMask)) 840 if (!pTextMask->Create(width, height, FXDIB_8bppMask))
848 return TRUE; 841 return TRUE;
849 842
850 pTextMask->Clear(0); 843 pTextMask->Clear(0);
851 CFX_FxgeDevice text_device; 844 CFX_FxgeDevice text_device;
852 text_device.Attach(pTextMask.get()); 845 text_device.Attach(pTextMask.get());
853 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { 846 for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
854 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); 847 CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
855 if (textobj == NULL) { 848 if (textobj == NULL) {
856 break; 849 break;
857 } 850 }
858 CFX_AffineMatrix text_matrix; 851 CFX_Matrix text_matrix;
859 textobj->GetTextMatrix(&text_matrix); 852 textobj->GetTextMatrix(&text_matrix);
860 CPDF_TextRenderer::DrawTextPath( 853 CPDF_TextRenderer::DrawTextPath(
861 &text_device, textobj->m_nChars, textobj->m_pCharCodes, 854 &text_device, textobj->m_nChars, textobj->m_pCharCodes,
862 textobj->m_pCharPos, textobj->m_TextState.GetFont(), 855 textobj->m_pCharPos, textobj->m_TextState.GetFont(),
863 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix, 856 textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix,
864 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL); 857 textobj->m_GraphState, (FX_ARGB)-1, 0, NULL);
865 } 858 }
866 } 859 }
867 CPDF_RenderStatus bitmap_render; 860 CPDF_RenderStatus bitmap_render;
868 bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL, 861 bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL,
869 NULL, &m_Options, 0, m_bDropObjects, pFormResource, 862 NULL, &m_Options, 0, m_bDropObjects, pFormResource,
870 TRUE); 863 TRUE);
871 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); 864 bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix);
872 m_bStopped = bitmap_render.m_bStopped; 865 m_bStopped = bitmap_render.m_bStopped;
873 if (pSMaskDict) { 866 if (pSMaskDict) {
874 CFX_AffineMatrix smask_matrix; 867 CFX_Matrix smask_matrix;
875 FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix, 868 FXSYS_memcpy(&smask_matrix, pGeneralState->m_SMaskMatrix,
876 sizeof smask_matrix); 869 sizeof smask_matrix);
877 smask_matrix.Concat(*pObj2Device); 870 smask_matrix.Concat(*pObj2Device);
878 nonstd::unique_ptr<CFX_DIBSource> pSMaskSource( 871 nonstd::unique_ptr<CFX_DIBSource> pSMaskSource(
879 LoadSMask(pSMaskDict, &rect, &smask_matrix)); 872 LoadSMask(pSMaskDict, &rect, &smask_matrix));
880 if (pSMaskSource) 873 if (pSMaskSource)
881 bitmap->MultiplyAlpha(pSMaskSource.get()); 874 bitmap->MultiplyAlpha(pSMaskSource.get());
882 } 875 }
883 if (pTextMask) { 876 if (pTextMask) {
884 bitmap->MultiplyAlpha(pTextMask.get()); 877 bitmap->MultiplyAlpha(pTextMask.get());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 if (pBackdrop->HasAlpha()) 916 if (pBackdrop->HasAlpha())
924 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT); 917 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);
925 else 918 else
926 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS); 919 bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);
927 920
928 if (!bNeedDraw) { 921 if (!bNeedDraw) {
929 m_pDevice->GetDIBits(pBackdrop.get(), left, top); 922 m_pDevice->GetDIBits(pBackdrop.get(), left, top);
930 return pBackdrop.release(); 923 return pBackdrop.release();
931 } 924 }
932 925
933 CFX_AffineMatrix FinalMatrix = m_DeviceMatrix; 926 CFX_Matrix FinalMatrix = m_DeviceMatrix;
934 FinalMatrix.TranslateI(-left, -top); 927 FinalMatrix.TranslateI(-left, -top);
935 FinalMatrix.Scale(scaleX, scaleY); 928 FinalMatrix.Scale(scaleX, scaleY);
936 pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff); 929 pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);
937 CFX_FxgeDevice device; 930 CFX_FxgeDevice device;
938 device.Attach(pBackdrop.get()); 931 device.Attach(pBackdrop.get());
939 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); 932 m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);
940 return pBackdrop.release(); 933 return pBackdrop.release();
941 } 934 }
942 935
943 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer, 936 void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
944 const CPDF_PageObject* pObj, 937 const CPDF_PageObject* pObj,
945 const CPDF_RenderOptions* pOptions, 938 const CPDF_RenderOptions* pOptions,
946 CFX_AffineMatrix* pFinalMatrix) { 939 CFX_Matrix* pFinalMatrix) {
947 CFX_FxgeDevice device; 940 CFX_FxgeDevice device;
948 device.Attach(pBuffer); 941 device.Attach(pBuffer);
949 942
950 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); 943 FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
951 device.FillRect(&rect, 0xffffffff); 944 device.FillRect(&rect, 0xffffffff);
952 Render(&device, pObj, pOptions, pFinalMatrix); 945 Render(&device, pObj, pOptions, pFinalMatrix);
953 } 946 }
954 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( 947 CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(
955 const CPDF_GraphicStates* pSrcStates, 948 const CPDF_GraphicStates* pSrcStates,
956 FX_BOOL bStroke) { 949 FX_BOOL bStroke) {
(...skipping 30 matching lines...) Expand all
987 m_bFirstLayer = bFirstLayer; 980 m_bFirstLayer = bFirstLayer;
988 } 981 }
989 CPDF_RenderContext::~CPDF_RenderContext() {} 982 CPDF_RenderContext::~CPDF_RenderContext() {}
990 void CPDF_RenderContext::Clear() { 983 void CPDF_RenderContext::Clear() {
991 m_pDocument = NULL; 984 m_pDocument = NULL;
992 m_pPageResources = NULL; 985 m_pPageResources = NULL;
993 m_pPageCache = NULL; 986 m_pPageCache = NULL;
994 m_bFirstLayer = TRUE; 987 m_bFirstLayer = TRUE;
995 m_ContentList.RemoveAll(); 988 m_ContentList.RemoveAll();
996 } 989 }
997 void CPDF_RenderContext::AppendObjectList( 990 void CPDF_RenderContext::AppendObjectList(CPDF_PageObjects* pObjs,
998 CPDF_PageObjects* pObjs, 991 const CFX_Matrix* pObject2Device) {
999 const CFX_AffineMatrix* pObject2Device) {
1000 _PDF_RenderItem* pItem = m_ContentList.AddSpace(); 992 _PDF_RenderItem* pItem = m_ContentList.AddSpace();
1001 pItem->m_pObjectList = pObjs; 993 pItem->m_pObjectList = pObjs;
1002 if (pObject2Device) { 994 if (pObject2Device) {
1003 pItem->m_Matrix = *pObject2Device; 995 pItem->m_Matrix = *pObject2Device;
1004 } else { 996 } else {
1005 pItem->m_Matrix.SetIdentity(); 997 pItem->m_Matrix.SetIdentity();
1006 } 998 }
1007 } 999 }
1008 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 1000 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
1009 const CPDF_RenderOptions* pOptions, 1001 const CPDF_RenderOptions* pOptions,
1010 const CFX_AffineMatrix* pLastMatrix) { 1002 const CFX_Matrix* pLastMatrix) {
1011 Render(pDevice, NULL, pOptions, pLastMatrix); 1003 Render(pDevice, NULL, pOptions, pLastMatrix);
1012 } 1004 }
1013 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, 1005 void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
1014 const CPDF_PageObject* pStopObj, 1006 const CPDF_PageObject* pStopObj,
1015 const CPDF_RenderOptions* pOptions, 1007 const CPDF_RenderOptions* pOptions,
1016 const CFX_AffineMatrix* pLastMatrix) { 1008 const CFX_Matrix* pLastMatrix) {
1017 int count = m_ContentList.GetSize(); 1009 int count = m_ContentList.GetSize();
1018 for (int j = 0; j < count; j++) { 1010 for (int j = 0; j < count; j++) {
1019 pDevice->SaveState(); 1011 pDevice->SaveState();
1020 _PDF_RenderItem* pItem = m_ContentList.GetDataPtr(j); 1012 _PDF_RenderItem* pItem = m_ContentList.GetDataPtr(j);
1021 if (pLastMatrix) { 1013 if (pLastMatrix) {
1022 CFX_AffineMatrix FinalMatrix = pItem->m_Matrix; 1014 CFX_Matrix FinalMatrix = pItem->m_Matrix;
1023 FinalMatrix.Concat(*pLastMatrix); 1015 FinalMatrix.Concat(*pLastMatrix);
1024 CPDF_RenderStatus status; 1016 CPDF_RenderStatus status;
1025 status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL, 1017 status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL,
1026 pOptions, pItem->m_pObjectList->m_Transparency, FALSE, 1018 pOptions, pItem->m_pObjectList->m_Transparency, FALSE,
1027 NULL); 1019 NULL);
1028 status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix); 1020 status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix);
1029 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { 1021 if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) {
1030 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); 1022 m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
1031 } 1023 }
1032 if (status.m_bStopped) { 1024 if (status.m_bStopped) {
(...skipping 11 matching lines...) Expand all
1044 if (status.m_bStopped) { 1036 if (status.m_bStopped) {
1045 pDevice->RestoreState(); 1037 pDevice->RestoreState();
1046 break; 1038 break;
1047 } 1039 }
1048 } 1040 }
1049 pDevice->RestoreState(); 1041 pDevice->RestoreState();
1050 } 1042 }
1051 } 1043 }
1052 void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice, 1044 void CPDF_RenderContext::DrawObjectList(CFX_RenderDevice* pDevice,
1053 CPDF_PageObjects* pObjs, 1045 CPDF_PageObjects* pObjs,
1054 const CFX_AffineMatrix* pObject2Device, 1046 const CFX_Matrix* pObject2Device,
1055 const CPDF_RenderOptions* pOptions) { 1047 const CPDF_RenderOptions* pOptions) {
1056 AppendObjectList(pObjs, pObject2Device); 1048 AppendObjectList(pObjs, pObject2Device);
1057 Render(pDevice, pOptions); 1049 Render(pDevice, pOptions);
1058 } 1050 }
1059 1051
1060 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer( 1052 CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer(
1061 CPDF_RenderContext* pContext, 1053 CPDF_RenderContext* pContext,
1062 CFX_RenderDevice* pDevice, 1054 CFX_RenderDevice* pDevice,
1063 const CPDF_RenderOptions* pOptions) 1055 const CPDF_RenderOptions* pOptions)
1064 : m_Status(Ready), 1056 : m_Status(Ready),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1115 }
1124 if (!m_pRenderStatus) { 1116 if (!m_pRenderStatus) {
1125 m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition(); 1117 m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition();
1126 m_ObjectIndex = 0; 1118 m_ObjectIndex = 0;
1127 m_pRenderStatus.reset(new CPDF_RenderStatus()); 1119 m_pRenderStatus.reset(new CPDF_RenderStatus());
1128 m_pRenderStatus->Initialize( 1120 m_pRenderStatus->Initialize(
1129 m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, 1121 m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions,
1130 pItem->m_pObjectList->m_Transparency, FALSE, NULL); 1122 pItem->m_pObjectList->m_Transparency, FALSE, NULL);
1131 m_pDevice->SaveState(); 1123 m_pDevice->SaveState();
1132 m_ClipRect = m_pDevice->GetClipBox(); 1124 m_ClipRect = m_pDevice->GetClipBox();
1133 CFX_AffineMatrix device2object; 1125 CFX_Matrix device2object;
1134 device2object.SetReverse(pItem->m_Matrix); 1126 device2object.SetReverse(pItem->m_Matrix);
1135 device2object.TransformRect(m_ClipRect); 1127 device2object.TransformRect(m_ClipRect);
1136 } 1128 }
1137 int objs_to_go = CPDF_ModuleMgr::Get() 1129 int objs_to_go = CPDF_ModuleMgr::Get()
1138 ->GetRenderModule() 1130 ->GetRenderModule()
1139 ->GetConfig() 1131 ->GetConfig()
1140 ->m_RenderStepLimit; 1132 ->m_RenderStepLimit;
1141 while (m_ObjectPos) { 1133 while (m_ObjectPos) {
1142 CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_ObjectPos); 1134 CPDF_PageObject* pCurObj = pItem->m_pObjectList->GetObjectAt(m_ObjectPos);
1143 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right && 1135 if (pCurObj && pCurObj->m_Left <= m_ClipRect.right &&
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) { 1418 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) {
1427 CPDF_Dictionary* pOCG = 1419 CPDF_Dictionary* pOCG =
1428 ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); 1420 ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
1429 if (!CheckOCGVisible(pOCG)) { 1421 if (!CheckOCGVisible(pOCG)) {
1430 return FALSE; 1422 return FALSE;
1431 } 1423 }
1432 } 1424 }
1433 } 1425 }
1434 return TRUE; 1426 return TRUE;
1435 } 1427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698