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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 } | 1544 } |
1545 CFX_ImageRenderer::CFX_ImageRenderer() { | 1545 CFX_ImageRenderer::CFX_ImageRenderer() { |
1546 m_Status = 0; | 1546 m_Status = 0; |
1547 m_pTransformer = NULL; | 1547 m_pTransformer = NULL; |
1548 m_bRgbByteOrder = FALSE; | 1548 m_bRgbByteOrder = FALSE; |
1549 m_BlendType = FXDIB_BLEND_NORMAL; | 1549 m_BlendType = FXDIB_BLEND_NORMAL; |
1550 } | 1550 } |
1551 CFX_ImageRenderer::~CFX_ImageRenderer() { | 1551 CFX_ImageRenderer::~CFX_ImageRenderer() { |
1552 delete m_pTransformer; | 1552 delete m_pTransformer; |
1553 } | 1553 } |
1554 extern FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, | |
1555 int width, | |
1556 int height, | |
1557 FX_BOOL bFlipX, | |
1558 FX_BOOL bFlipY); | |
1559 FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, | 1554 FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, |
1560 const CFX_ClipRgn* pClipRgn, | 1555 const CFX_ClipRgn* pClipRgn, |
1561 const CFX_DIBSource* pSource, | 1556 const CFX_DIBSource* pSource, |
1562 int bitmap_alpha, | 1557 int bitmap_alpha, |
1563 FX_DWORD mask_color, | 1558 FX_DWORD mask_color, |
1564 const CFX_AffineMatrix* pMatrix, | 1559 const CFX_AffineMatrix* pMatrix, |
1565 FX_DWORD dib_flags, | 1560 FX_DWORD dib_flags, |
1566 FX_BOOL bRgbByteOrder, | 1561 FX_BOOL bRgbByteOrder, |
1567 int alpha_flag, | 1562 int alpha_flag, |
1568 void* pIccTransform, | 1563 void* pIccTransform, |
(...skipping 20 matching lines...) Expand all Loading... |
1589 FX_BOOL ret = TRUE; | 1584 FX_BOOL ret = TRUE; |
1590 if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || | 1585 if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || |
1591 (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { | 1586 (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { |
1592 if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && | 1587 if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && |
1593 FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && | 1588 FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && |
1594 FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) { | 1589 FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) { |
1595 int dest_width = image_rect.Width(); | 1590 int dest_width = image_rect.Width(); |
1596 int dest_height = image_rect.Height(); | 1591 int dest_height = image_rect.Height(); |
1597 FX_RECT bitmap_clip = m_ClipBox; | 1592 FX_RECT bitmap_clip = m_ClipBox; |
1598 bitmap_clip.Offset(-image_rect.left, -image_rect.top); | 1593 bitmap_clip.Offset(-image_rect.left, -image_rect.top); |
1599 bitmap_clip = _FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, | 1594 bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, |
1600 m_Matrix.c > 0, m_Matrix.b < 0); | 1595 m_Matrix.c > 0, m_Matrix.b < 0); |
1601 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, | 1596 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, |
1602 TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, | 1597 TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, |
1603 alpha_flag, pIccTransform, m_BlendType); | 1598 alpha_flag, pIccTransform, m_BlendType); |
1604 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, | 1599 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width, |
1605 bitmap_clip, dib_flags)) { | 1600 bitmap_clip, dib_flags)) { |
1606 return FALSE; | 1601 return FALSE; |
1607 } | 1602 } |
1608 m_Status = 1; | 1603 m_Status = 1; |
1609 return TRUE; | 1604 return TRUE; |
1610 } | 1605 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 if (!m_pBitmap->Create(width, height, src_format)) { | 1713 if (!m_pBitmap->Create(width, height, src_format)) { |
1719 delete m_pBitmap; | 1714 delete m_pBitmap; |
1720 m_pBitmap = NULL; | 1715 m_pBitmap = NULL; |
1721 return FALSE; | 1716 return FALSE; |
1722 } | 1717 } |
1723 if (pSrcPalette) { | 1718 if (pSrcPalette) { |
1724 m_pBitmap->CopyPalette(pSrcPalette); | 1719 m_pBitmap->CopyPalette(pSrcPalette); |
1725 } | 1720 } |
1726 return TRUE; | 1721 return TRUE; |
1727 } | 1722 } |
OLD | NEW |