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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 m_pOriDevice = pOriDevice; | 1089 m_pOriDevice = pOriDevice; |
1090 if (m_pClipRgn) { | 1090 if (m_pClipRgn) { |
1091 m_ClipBox = m_pClipRgn->GetBox(); | 1091 m_ClipBox = m_pClipRgn->GetBox(); |
1092 } else { | 1092 } else { |
1093 m_ClipBox.left = m_ClipBox.top = 0; | 1093 m_ClipBox.left = m_ClipBox.top = 0; |
1094 m_ClipBox.right = m_pDevice->GetWidth(); | 1094 m_ClipBox.right = m_pDevice->GetWidth(); |
1095 m_ClipBox.bottom = m_pDevice->GetHeight(); | 1095 m_ClipBox.bottom = m_pDevice->GetHeight(); |
1096 } | 1096 } |
1097 m_pClipMask = nullptr; | 1097 m_pClipMask = nullptr; |
1098 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { | 1098 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { |
1099 m_pClipMask = m_pClipRgn->GetMask(); | 1099 m_pClipMask = m_pClipRgn->GetMask().GetObject(); |
1100 } | 1100 } |
1101 m_bFullCover = bFullCover; | 1101 m_bFullCover = bFullCover; |
1102 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); | 1102 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); |
1103 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); | 1103 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); |
1104 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); | 1104 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); |
1105 CCodec_IccModule* pIccModule = nullptr; | 1105 CCodec_IccModule* pIccModule = nullptr; |
1106 if (!CFX_GEModule::Get()->GetCodecModule() || | 1106 if (!CFX_GEModule::Get()->GetCodecModule() || |
1107 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | 1107 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
1108 pIccTransform = nullptr; | 1108 pIccTransform = nullptr; |
1109 } else { | 1109 } else { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); | 1555 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); |
1556 } | 1556 } |
1557 } else if (m_pClipRgn->GetBox().Contains(x, y)) { | 1557 } else if (m_pClipRgn->GetBox().Contains(x, y)) { |
1558 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { | 1558 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { |
1559 if (m_bRgbByteOrder) { | 1559 if (m_bRgbByteOrder) { |
1560 RgbByteOrderSetPixel(m_pBitmap, x, y, color); | 1560 RgbByteOrderSetPixel(m_pBitmap, x, y, color); |
1561 } else { | 1561 } else { |
1562 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); | 1562 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); |
1563 } | 1563 } |
1564 } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { | 1564 } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { |
1565 const CFX_DIBitmap* pMask = m_pClipRgn->GetMask(); | 1565 const CFX_DIBitmap* pMask = m_pClipRgn->GetMask().GetObject(); |
1566 FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); | 1566 FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); |
1567 int new_alpha = | 1567 int new_alpha = |
1568 bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); | 1568 bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); |
1569 new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255; | 1569 new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255; |
1570 if (m_bRgbByteOrder) { | 1570 if (m_bRgbByteOrder) { |
1571 RgbByteOrderSetPixel(m_pBitmap, x, y, | 1571 RgbByteOrderSetPixel(m_pBitmap, x, y, |
1572 (color & 0xffffff) | (new_alpha << 24)); | 1572 (color & 0xffffff) | (new_alpha << 24)); |
1573 return TRUE; | 1573 return TRUE; |
1574 } | 1574 } |
1575 if (bCMYK) { | 1575 if (bCMYK) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 fill_color); | 1610 fill_color); |
1611 } else { | 1611 } else { |
1612 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(), | 1612 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(), |
1613 draw_rect.Height(), fill_color, alpha_flag, | 1613 draw_rect.Height(), fill_color, alpha_flag, |
1614 pIccTransform); | 1614 pIccTransform); |
1615 } | 1615 } |
1616 return TRUE; | 1616 return TRUE; |
1617 } | 1617 } |
1618 m_pBitmap->CompositeMask( | 1618 m_pBitmap->CompositeMask( |
1619 draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), | 1619 draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), |
1620 (const CFX_DIBitmap*)m_pClipRgn->GetMask(), fill_color, | 1620 m_pClipRgn->GetMask().GetObject(), fill_color, |
1621 draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top, | 1621 draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top, |
1622 FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, alpha_flag, pIccTransform); | 1622 FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, alpha_flag, pIccTransform); |
1623 return TRUE; | 1623 return TRUE; |
1624 } | 1624 } |
1625 | 1625 |
1626 FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { | 1626 FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { |
1627 if (!m_pClipRgn) { | 1627 if (!m_pClipRgn) { |
1628 pRect->left = pRect->top = 0; | 1628 pRect->left = pRect->top = 0; |
1629 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); | 1629 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); |
1630 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); | 1630 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 SetDeviceDriver(pDriver); | 1809 SetDeviceDriver(pDriver); |
1810 return true; | 1810 return true; |
1811 } | 1811 } |
1812 | 1812 |
1813 CFX_FxgeDevice::~CFX_FxgeDevice() { | 1813 CFX_FxgeDevice::~CFX_FxgeDevice() { |
1814 if (m_bOwnedBitmap) { | 1814 if (m_bOwnedBitmap) { |
1815 delete GetBitmap(); | 1815 delete GetBitmap(); |
1816 } | 1816 } |
1817 } | 1817 } |
1818 #endif | 1818 #endif |
OLD | NEW |