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 "core/fxge/agg/fx_agg_driver.h" | 7 #include "core/fxge/agg/fx_agg_driver.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 418 |
419 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( | 419 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( |
420 CFX_DIBitmap* pBitmap, | 420 CFX_DIBitmap* pBitmap, |
421 FX_BOOL bRgbByteOrder, | 421 FX_BOOL bRgbByteOrder, |
422 CFX_DIBitmap* pOriDevice, | 422 CFX_DIBitmap* pOriDevice, |
423 FX_BOOL bGroupKnockout) { | 423 FX_BOOL bGroupKnockout) { |
424 return new CFX_AggDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice, | 424 return new CFX_AggDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice, |
425 bGroupKnockout); | 425 bGroupKnockout); |
426 } | 426 } |
427 | 427 |
| 428 IFX_RenderDeviceDriver::~IFX_RenderDeviceDriver() {} |
| 429 |
| 430 CFX_Matrix IFX_RenderDeviceDriver::GetCTM() const { |
| 431 return CFX_Matrix(); |
| 432 } |
| 433 |
| 434 FX_BOOL IFX_RenderDeviceDriver::StartRendering() { |
| 435 return TRUE; |
| 436 } |
| 437 |
| 438 void IFX_RenderDeviceDriver::EndRendering() {} |
| 439 |
| 440 FX_BOOL IFX_RenderDeviceDriver::SetClip_PathStroke( |
| 441 const CFX_PathData* pPathData, |
| 442 const CFX_Matrix* pObject2Device, |
| 443 const CFX_GraphStateData* pGraphState) { |
| 444 return FALSE; |
| 445 } |
| 446 |
| 447 FX_BOOL IFX_RenderDeviceDriver::SetPixel(int x, int y, uint32_t color) { |
| 448 return FALSE; |
| 449 } |
| 450 |
| 451 FX_BOOL IFX_RenderDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, |
| 452 uint32_t fill_color, |
| 453 int blend_type) { |
| 454 return FALSE; |
| 455 } |
| 456 |
| 457 FX_BOOL IFX_RenderDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, |
| 458 FX_FLOAT y1, |
| 459 FX_FLOAT x2, |
| 460 FX_FLOAT y2, |
| 461 uint32_t color, |
| 462 int blend_type) { |
| 463 return FALSE; |
| 464 } |
| 465 |
| 466 FX_BOOL IFX_RenderDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, |
| 467 int left, |
| 468 int top) { |
| 469 return FALSE; |
| 470 } |
| 471 CFX_DIBitmap* IFX_RenderDeviceDriver::GetBackDrop() { |
| 472 return nullptr; |
| 473 } |
| 474 |
| 475 FX_BOOL IFX_RenderDeviceDriver::ContinueDIBits(void* handle, |
| 476 IFX_Pause* pPause) { |
| 477 return FALSE; |
| 478 } |
| 479 |
| 480 void IFX_RenderDeviceDriver::CancelDIBits(void* handle) {} |
| 481 |
| 482 FX_BOOL IFX_RenderDeviceDriver::DrawDeviceText(int nChars, |
| 483 const FXTEXT_CHARPOS* pCharPos, |
| 484 CFX_Font* pFont, |
| 485 CFX_FontCache* pCache, |
| 486 const CFX_Matrix* pObject2Device, |
| 487 FX_FLOAT font_size, |
| 488 uint32_t color) { |
| 489 return FALSE; |
| 490 } |
| 491 |
| 492 void* IFX_RenderDeviceDriver::GetPlatformSurface() const { |
| 493 return nullptr; |
| 494 } |
| 495 |
| 496 int IFX_RenderDeviceDriver::GetDriverType() const { |
| 497 return 0; |
| 498 } |
| 499 |
| 500 void IFX_RenderDeviceDriver::ClearDriver() {} |
| 501 |
| 502 FX_BOOL IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, |
| 503 const CFX_Matrix* pMatrix, |
| 504 const FX_RECT& clip_rect, |
| 505 int alpha, |
| 506 FX_BOOL bAlphaMode) { |
| 507 return false; |
| 508 } |
| 509 |
428 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, | 510 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, |
429 FX_BOOL bRgbByteOrder, | 511 FX_BOOL bRgbByteOrder, |
430 CFX_DIBitmap* pOriDevice, | 512 CFX_DIBitmap* pOriDevice, |
431 FX_BOOL bGroupKnockout) { | 513 FX_BOOL bGroupKnockout) { |
432 m_pBitmap = pBitmap; | 514 m_pBitmap = pBitmap; |
433 m_pClipRgn = nullptr; | 515 m_pClipRgn = nullptr; |
434 m_pPlatformBitmap = nullptr; | 516 m_pPlatformBitmap = nullptr; |
435 m_pPlatformGraphics = nullptr; | 517 m_pPlatformGraphics = nullptr; |
436 m_pDwRenderTartget = nullptr; | 518 m_pDwRenderTartget = nullptr; |
437 m_bRgbByteOrder = bRgbByteOrder; | 519 m_bRgbByteOrder = bRgbByteOrder; |
438 m_pOriDevice = pOriDevice; | 520 m_pOriDevice = pOriDevice; |
439 m_bGroupKnockout = bGroupKnockout; | 521 m_bGroupKnockout = bGroupKnockout; |
440 m_FillFlags = 0; | 522 m_FillFlags = 0; |
441 InitPlatform(); | 523 InitPlatform(); |
442 } | 524 } |
443 | 525 |
444 CFX_AggDeviceDriver::~CFX_AggDeviceDriver() { | 526 CFX_AggDeviceDriver::~CFX_AggDeviceDriver() { |
445 delete m_pClipRgn; | 527 delete m_pClipRgn; |
446 for (int i = 0; i < m_StateStack.GetSize(); i++) | 528 for (int i = 0; i < m_StateStack.GetSize(); i++) |
447 delete m_StateStack[i]; | 529 delete m_StateStack[i]; |
448 DestroyPlatform(); | 530 DestroyPlatform(); |
449 } | 531 } |
450 | 532 |
451 uint8_t* CFX_AggDeviceDriver::GetBuffer() const { | 533 uint8_t* CFX_AggDeviceDriver::GetBuffer() const { |
452 return m_pBitmap->GetBuffer(); | 534 return m_pBitmap->GetBuffer(); |
453 } | 535 } |
454 | 536 |
| 537 const CFX_DIBitmap* CFX_AggDeviceDriver::GetBitmap() const { |
| 538 return m_pBitmap; |
| 539 } |
| 540 |
455 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 541 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
456 void CFX_AggDeviceDriver::InitPlatform() {} | 542 void CFX_AggDeviceDriver::InitPlatform() {} |
457 | 543 |
458 void CFX_AggDeviceDriver::DestroyPlatform() {} | 544 void CFX_AggDeviceDriver::DestroyPlatform() {} |
459 | 545 |
460 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, | 546 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, |
461 const FXTEXT_CHARPOS* pCharPos, | 547 const FXTEXT_CHARPOS* pCharPos, |
462 CFX_Font* pFont, | 548 CFX_Font* pFont, |
463 CFX_FontCache* pCache, | 549 CFX_FontCache* pCache, |
464 const CFX_Matrix* pObject2Device, | 550 const CFX_Matrix* pObject2Device, |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 } | 1514 } |
1429 } | 1515 } |
1430 } | 1516 } |
1431 if (m_pDevice->GetBPP() == 1) { | 1517 if (m_pDevice->GetBPP() == 1) { |
1432 composite_span = &CFX_Renderer::CompositeSpan1bpp; | 1518 composite_span = &CFX_Renderer::CompositeSpan1bpp; |
1433 } | 1519 } |
1434 return TRUE; | 1520 return TRUE; |
1435 } | 1521 } |
1436 }; | 1522 }; |
1437 | 1523 |
| 1524 int CFX_AggDeviceDriver::GetDriverType() const { |
| 1525 return 1; |
| 1526 } |
| 1527 |
1438 FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( | 1528 FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( |
1439 agg::rasterizer_scanline_aa& rasterizer, | 1529 agg::rasterizer_scanline_aa& rasterizer, |
1440 uint32_t color, | 1530 uint32_t color, |
1441 FX_BOOL bFullCover, | 1531 FX_BOOL bFullCover, |
1442 FX_BOOL bGroupKnockout, | 1532 FX_BOOL bGroupKnockout, |
1443 int alpha_flag, | 1533 int alpha_flag, |
1444 void* pIccTransform) { | 1534 void* pIccTransform) { |
1445 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr; | 1535 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : nullptr; |
1446 CFX_Renderer render; | 1536 CFX_Renderer render; |
1447 if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, | 1537 if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), | 1728 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), |
1639 pBack, left, top); | 1729 pBack, left, top); |
1640 } else { | 1730 } else { |
1641 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, | 1731 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, |
1642 left, top, nullptr); | 1732 left, top, nullptr); |
1643 } | 1733 } |
1644 delete pBack; | 1734 delete pBack; |
1645 return bRet; | 1735 return bRet; |
1646 } | 1736 } |
1647 | 1737 |
| 1738 CFX_DIBitmap* CFX_AggDeviceDriver::GetBackDrop() { |
| 1739 return m_pOriDevice; |
| 1740 } |
| 1741 |
1648 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 1742 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
1649 uint32_t argb, | 1743 uint32_t argb, |
1650 const FX_RECT* pSrcRect, | 1744 const FX_RECT* pSrcRect, |
1651 int left, | 1745 int left, |
1652 int top, | 1746 int top, |
1653 int blend_type) { | 1747 int blend_type) { |
1654 if (!m_pBitmap->GetBuffer()) | 1748 if (!m_pBitmap->GetBuffer()) |
1655 return TRUE; | 1749 return TRUE; |
1656 | 1750 |
1657 if (pBitmap->IsAlphaMask()) { | 1751 if (pBitmap->IsAlphaMask()) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 SetDeviceDriver(pDriver); | 1858 SetDeviceDriver(pDriver); |
1765 return true; | 1859 return true; |
1766 } | 1860 } |
1767 | 1861 |
1768 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1862 CFX_FxgeDevice::~CFX_FxgeDevice() { |
1769 if (m_bOwnedBitmap) { | 1863 if (m_bOwnedBitmap) { |
1770 delete GetBitmap(); | 1864 delete GetBitmap(); |
1771 } | 1865 } |
1772 } | 1866 } |
1773 #endif | 1867 #endif |
OLD | NEW |