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/fxge/fx_dib.h" | 7 #include "../../../include/fxge/fx_dib.h" |
8 #include "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "dib_int.h" | 10 #include "dib_int.h" |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 } | 1571 } |
1572 CFX_ImageRenderer::CFX_ImageRenderer() { | 1572 CFX_ImageRenderer::CFX_ImageRenderer() { |
1573 m_Status = 0; | 1573 m_Status = 0; |
1574 m_pTransformer = NULL; | 1574 m_pTransformer = NULL; |
1575 m_bRgbByteOrder = FALSE; | 1575 m_bRgbByteOrder = FALSE; |
1576 m_BlendType = FXDIB_BLEND_NORMAL; | 1576 m_BlendType = FXDIB_BLEND_NORMAL; |
1577 } | 1577 } |
1578 CFX_ImageRenderer::~CFX_ImageRenderer() { | 1578 CFX_ImageRenderer::~CFX_ImageRenderer() { |
1579 delete m_pTransformer; | 1579 delete m_pTransformer; |
1580 } | 1580 } |
1581 extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, | |
1582 int width, | |
1583 int height, | |
1584 FX_BOOL bFlipX, | |
1585 FX_BOOL bFlipY); | |
1586 FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, | 1581 FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, |
1587 const CFX_ClipRgn* pClipRgn, | 1582 const CFX_ClipRgn* pClipRgn, |
1588 const CFX_DIBSource* pSource, | 1583 const CFX_DIBSource* pSource, |
1589 int bitmap_alpha, | 1584 int bitmap_alpha, |
1590 FX_DWORD mask_color, | 1585 FX_DWORD mask_color, |
1591 const CFX_AffineMatrix* pMatrix, | 1586 const CFX_AffineMatrix* pMatrix, |
1592 FX_DWORD dib_flags, | 1587 FX_DWORD dib_flags, |
1593 FX_BOOL bRgbByteOrder, | 1588 FX_BOOL bRgbByteOrder, |
1594 int alpha_flag, | 1589 int alpha_flag, |
1595 void* pIccTransform, | 1590 void* pIccTransform, |
(...skipping 20 matching lines...) Expand all Loading... |
1616 FX_BOOL ret = TRUE; | 1611 FX_BOOL ret = TRUE; |
1617 if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || | 1612 if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || |
1618 (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { | 1613 (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { |
1619 if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && | 1614 if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && |
1620 FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && | 1615 FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && |
1621 FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) { | 1616 FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) { |
1622 int dest_width = image_rect.Width(); | 1617 int dest_width = image_rect.Width(); |
1623 int dest_height = image_rect.Height(); | 1618 int dest_height = image_rect.Height(); |
1624 FX_RECT bitmap_clip = m_ClipBox; | 1619 FX_RECT bitmap_clip = m_ClipBox; |
1625 bitmap_clip.Offset(-image_rect.left, -image_rect.top); | 1620 bitmap_clip.Offset(-image_rect.left, -image_rect.top); |
1626 bitmap_clip = _FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, | 1621 bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, |
1627 m_Matrix.c > 0, m_Matrix.b < 0); | 1622 m_Matrix.c > 0, m_Matrix.b < 0); |
1628 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, | 1623 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, |
1629 TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, | 1624 TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, |
1630 alpha_flag, pIccTransform, m_BlendType); | 1625 alpha_flag, pIccTransform, m_BlendType); |
1631 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, | 1626 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, |
1632 bitmap_clip, dib_flags)) { | 1627 bitmap_clip, dib_flags)) { |
1633 return FALSE; | 1628 return FALSE; |
1634 } | 1629 } |
1635 m_Status = 1; | 1630 m_Status = 1; |
1636 return TRUE; | 1631 return TRUE; |
1637 } | 1632 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 if (!m_pBitmap->Create(width, height, src_format)) { | 1746 if (!m_pBitmap->Create(width, height, src_format)) { |
1752 delete m_pBitmap; | 1747 delete m_pBitmap; |
1753 m_pBitmap = NULL; | 1748 m_pBitmap = NULL; |
1754 return FALSE; | 1749 return FALSE; |
1755 } | 1750 } |
1756 if (pSrcPalette) { | 1751 if (pSrcPalette) { |
1757 m_pBitmap->CopyPalette(pSrcPalette); | 1752 m_pBitmap->CopyPalette(pSrcPalette); |
1758 } | 1753 } |
1759 return TRUE; | 1754 return TRUE; |
1760 } | 1755 } |
OLD | NEW |