| 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 "xfa/fxfa/app/xfa_ffwidget.h" | 7 #include "xfa/fxfa/app/xfa_ffwidget.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 rtWidget.top = rtWidget.bottom(); | 62 rtWidget.top = rtWidget.bottom(); |
| 63 break; | 63 break; |
| 64 case 270: | 64 case 270: |
| 65 rtWidget.left = rtWidget.right(); | 65 rtWidget.left = rtWidget.right(); |
| 66 fValue = rtWidget.width; | 66 fValue = rtWidget.width; |
| 67 rtWidget.width = rtWidget.height; | 67 rtWidget.width = rtWidget.height; |
| 68 rtWidget.height = fValue; | 68 rtWidget.height = fValue; |
| 69 break; | 69 break; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 FX_DWORD CXFA_FFWidget::GetStatus() { | 72 uint32_t CXFA_FFWidget::GetStatus() { |
| 73 return m_dwStatus; | 73 return m_dwStatus; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void CXFA_FFWidget::ModifyStatus(FX_DWORD dwAdded, FX_DWORD dwRemoved) { | 76 void CXFA_FFWidget::ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved) { |
| 77 m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded; | 77 m_dwStatus = (m_dwStatus & ~dwRemoved) | dwAdded; |
| 78 } | 78 } |
| 79 | 79 |
| 80 FX_BOOL CXFA_FFWidget::GetBBox(CFX_RectF& rtBox, | 80 FX_BOOL CXFA_FFWidget::GetBBox(CFX_RectF& rtBox, |
| 81 FX_DWORD dwStatus, | 81 uint32_t dwStatus, |
| 82 FX_BOOL bDrawFocus) { | 82 FX_BOOL bDrawFocus) { |
| 83 if (bDrawFocus) | 83 if (bDrawFocus) |
| 84 return FALSE; | 84 return FALSE; |
| 85 if (m_pPageView) | 85 if (m_pPageView) |
| 86 m_pPageView->GetPageViewRect(rtBox); | 86 m_pPageView->GetPageViewRect(rtBox); |
| 87 return TRUE; | 87 return TRUE; |
| 88 } | 88 } |
| 89 | 89 |
| 90 CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { | 90 CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { |
| 91 return m_pDataAcc; | 91 return m_pDataAcc; |
| 92 } | 92 } |
| 93 FX_BOOL CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) { | 93 FX_BOOL CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) { |
| 94 if (CXFA_Assist assist = m_pDataAcc->GetAssist()) { | 94 if (CXFA_Assist assist = m_pDataAcc->GetAssist()) { |
| 95 if (CXFA_ToolTip toolTip = assist.GetToolTip()) { | 95 if (CXFA_ToolTip toolTip = assist.GetToolTip()) { |
| 96 return toolTip.GetTip(wsToolTip); | 96 return toolTip.GetTip(wsToolTip); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 return GetCaptionText(wsToolTip); | 99 return GetCaptionText(wsToolTip); |
| 100 } | 100 } |
| 101 void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS, | 101 void CXFA_FFWidget::RenderWidget(CFX_Graphics* pGS, |
| 102 CFX_Matrix* pMatrix, | 102 CFX_Matrix* pMatrix, |
| 103 FX_DWORD dwStatus, | 103 uint32_t dwStatus, |
| 104 int32_t iRotate) { | 104 int32_t iRotate) { |
| 105 if (!IsMatchVisibleStatus(dwStatus)) { | 105 if (!IsMatchVisibleStatus(dwStatus)) { |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 CXFA_Border border = m_pDataAcc->GetBorder(); | 108 CXFA_Border border = m_pDataAcc->GetBorder(); |
| 109 if (border) { | 109 if (border) { |
| 110 CFX_RectF rtBorder; | 110 CFX_RectF rtBorder; |
| 111 GetRectWithoutRotate(rtBorder); | 111 GetRectWithoutRotate(rtBorder); |
| 112 CXFA_Margin margin = border.GetMargin(); | 112 CXFA_Margin margin = border.GetMargin(); |
| 113 if (margin) { | 113 if (margin) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 130 return TRUE; | 130 return TRUE; |
| 131 } | 131 } |
| 132 FX_BOOL CXFA_FFWidget::UpdateFWLData() { | 132 FX_BOOL CXFA_FFWidget::UpdateFWLData() { |
| 133 return FALSE; | 133 return FALSE; |
| 134 } | 134 } |
| 135 void CXFA_FFWidget::UpdateWidgetProperty() {} | 135 void CXFA_FFWidget::UpdateWidgetProperty() {} |
| 136 void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS, | 136 void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS, |
| 137 CXFA_Box box, | 137 CXFA_Box box, |
| 138 const CFX_RectF& rtBorder, | 138 const CFX_RectF& rtBorder, |
| 139 CFX_Matrix* pMatrix, | 139 CFX_Matrix* pMatrix, |
| 140 FX_DWORD dwFlags) { | 140 uint32_t dwFlags) { |
| 141 XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags); | 141 XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags); |
| 142 } | 142 } |
| 143 void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) { | 143 void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) { |
| 144 if (!pRect) { | 144 if (!pRect) { |
| 145 CFX_RectF rtWidget; | 145 CFX_RectF rtWidget; |
| 146 GetBBox(rtWidget, XFA_WIDGETSTATUS_Focused); | 146 GetBBox(rtWidget, XFA_WIDGETSTATUS_Focused); |
| 147 rtWidget.Inflate(2, 2); | 147 rtWidget.Inflate(2, 2); |
| 148 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, rtWidget, | 148 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, rtWidget, |
| 149 XFA_INVALIDATE_CurrentPage); | 149 XFA_INVALIDATE_CurrentPage); |
| 150 } else { | 150 } else { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 172 } | 172 } |
| 173 FX_BOOL CXFA_FFWidget::IsFocused() { | 173 FX_BOOL CXFA_FFWidget::IsFocused() { |
| 174 return m_dwStatus & XFA_WIDGETSTATUS_Focused; | 174 return m_dwStatus & XFA_WIDGETSTATUS_Focused; |
| 175 } | 175 } |
| 176 FX_BOOL CXFA_FFWidget::OnMouseEnter() { | 176 FX_BOOL CXFA_FFWidget::OnMouseEnter() { |
| 177 return FALSE; | 177 return FALSE; |
| 178 } | 178 } |
| 179 FX_BOOL CXFA_FFWidget::OnMouseExit() { | 179 FX_BOOL CXFA_FFWidget::OnMouseExit() { |
| 180 return FALSE; | 180 return FALSE; |
| 181 } | 181 } |
| 182 FX_BOOL CXFA_FFWidget::OnLButtonDown(FX_DWORD dwFlags, | 182 FX_BOOL CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, |
| 183 FX_FLOAT fx, | 183 FX_FLOAT fx, |
| 184 FX_FLOAT fy) { | 184 FX_FLOAT fy) { |
| 185 return FALSE; | 185 return FALSE; |
| 186 } | 186 } |
| 187 FX_BOOL CXFA_FFWidget::OnLButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 187 FX_BOOL CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
| 188 return FALSE; | 188 return FALSE; |
| 189 } | 189 } |
| 190 FX_BOOL CXFA_FFWidget::OnLButtonDblClk(FX_DWORD dwFlags, | 190 FX_BOOL CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, |
| 191 FX_FLOAT fx, | 191 FX_FLOAT fx, |
| 192 FX_FLOAT fy) { | 192 FX_FLOAT fy) { |
| 193 return FALSE; | 193 return FALSE; |
| 194 } | 194 } |
| 195 FX_BOOL CXFA_FFWidget::OnMouseMove(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 195 FX_BOOL CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
| 196 return FALSE; | 196 return FALSE; |
| 197 } | 197 } |
| 198 FX_BOOL CXFA_FFWidget::OnMouseWheel(FX_DWORD dwFlags, | 198 FX_BOOL CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags, |
| 199 int16_t zDelta, | 199 int16_t zDelta, |
| 200 FX_FLOAT fx, | 200 FX_FLOAT fx, |
| 201 FX_FLOAT fy) { | 201 FX_FLOAT fy) { |
| 202 return FALSE; | 202 return FALSE; |
| 203 } | 203 } |
| 204 FX_BOOL CXFA_FFWidget::OnRButtonDown(FX_DWORD dwFlags, | 204 FX_BOOL CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, |
| 205 FX_FLOAT fx, | 205 FX_FLOAT fx, |
| 206 FX_FLOAT fy) { | 206 FX_FLOAT fy) { |
| 207 return FALSE; | 207 return FALSE; |
| 208 } | 208 } |
| 209 FX_BOOL CXFA_FFWidget::OnRButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 209 FX_BOOL CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
| 210 return FALSE; | 210 return FALSE; |
| 211 } | 211 } |
| 212 FX_BOOL CXFA_FFWidget::OnRButtonDblClk(FX_DWORD dwFlags, | 212 FX_BOOL CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, |
| 213 FX_FLOAT fx, | 213 FX_FLOAT fx, |
| 214 FX_FLOAT fy) { | 214 FX_FLOAT fy) { |
| 215 return FALSE; | 215 return FALSE; |
| 216 } | 216 } |
| 217 | 217 |
| 218 FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { | 218 FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { |
| 219 CXFA_FFWidget* pParent = GetParent(); | 219 CXFA_FFWidget* pParent = GetParent(); |
| 220 if (pParent && !pParent->IsAncestorOf(pOldWidget)) { | 220 if (pParent && !pParent->IsAncestorOf(pOldWidget)) { |
| 221 pParent->OnSetFocus(pOldWidget); | 221 pParent->OnSetFocus(pOldWidget); |
| 222 } | 222 } |
| 223 m_dwStatus |= XFA_WIDGETSTATUS_Focused; | 223 m_dwStatus |= XFA_WIDGETSTATUS_Focused; |
| 224 CXFA_EventParam eParam; | 224 CXFA_EventParam eParam; |
| 225 eParam.m_eType = XFA_EVENT_Enter; | 225 eParam.m_eType = XFA_EVENT_Enter; |
| 226 eParam.m_pTarget = m_pDataAcc; | 226 eParam.m_pTarget = m_pDataAcc; |
| 227 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); | 227 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); |
| 228 return TRUE; | 228 return TRUE; |
| 229 } | 229 } |
| 230 FX_BOOL CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { | 230 FX_BOOL CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { |
| 231 m_dwStatus &= ~XFA_WIDGETSTATUS_Focused; | 231 m_dwStatus &= ~XFA_WIDGETSTATUS_Focused; |
| 232 EventKillFocus(); | 232 EventKillFocus(); |
| 233 if (pNewWidget) { | 233 if (pNewWidget) { |
| 234 CXFA_FFWidget* pParent = GetParent(); | 234 CXFA_FFWidget* pParent = GetParent(); |
| 235 if (pParent && !pParent->IsAncestorOf(pNewWidget)) { | 235 if (pParent && !pParent->IsAncestorOf(pNewWidget)) { |
| 236 pParent->OnKillFocus(pNewWidget); | 236 pParent->OnKillFocus(pNewWidget); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 return TRUE; | 239 return TRUE; |
| 240 } | 240 } |
| 241 FX_BOOL CXFA_FFWidget::OnKeyDown(FX_DWORD dwKeyCode, FX_DWORD dwFlags) { | 241 FX_BOOL CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { |
| 242 return FALSE; | 242 return FALSE; |
| 243 } | 243 } |
| 244 FX_BOOL CXFA_FFWidget::OnKeyUp(FX_DWORD dwKeyCode, FX_DWORD dwFlags) { | 244 FX_BOOL CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { |
| 245 return FALSE; | 245 return FALSE; |
| 246 } | 246 } |
| 247 FX_BOOL CXFA_FFWidget::OnChar(FX_DWORD dwChar, FX_DWORD dwFlags) { | 247 FX_BOOL CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) { |
| 248 return FALSE; | 248 return FALSE; |
| 249 } | 249 } |
| 250 FX_DWORD CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { | 250 uint32_t CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 251 return FALSE; | 251 return FALSE; |
| 252 } | 252 } |
| 253 FX_BOOL CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { | 253 FX_BOOL CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { |
| 254 return FALSE; | 254 return FALSE; |
| 255 } | 255 } |
| 256 void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) { | 256 void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) { |
| 257 CFX_Matrix mt; | 257 CFX_Matrix mt; |
| 258 GetRotateMatrix(mt); | 258 GetRotateMatrix(mt); |
| 259 if (mt.IsIdentity()) { | 259 if (mt.IsIdentity()) { |
| 260 return; | 260 return; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 void CXFA_FFWidget::GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight) { | 391 void CXFA_FFWidget::GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight) { |
| 392 fMinHeight = fMaxHeight = 0; | 392 fMinHeight = fMaxHeight = 0; |
| 393 FX_FLOAT fHeight = 0; | 393 FX_FLOAT fHeight = 0; |
| 394 if (m_pDataAcc->GetHeight(fHeight)) { | 394 if (m_pDataAcc->GetHeight(fHeight)) { |
| 395 fMinHeight = fMaxHeight = fHeight; | 395 fMinHeight = fMaxHeight = fHeight; |
| 396 } else { | 396 } else { |
| 397 m_pDataAcc->GetMinHeight(fMinHeight); | 397 m_pDataAcc->GetMinHeight(fMinHeight); |
| 398 m_pDataAcc->GetMaxHeight(fMaxHeight); | 398 m_pDataAcc->GetMaxHeight(fMaxHeight); |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 FX_BOOL CXFA_FFWidget::IsMatchVisibleStatus(FX_DWORD dwStatus) { | 401 FX_BOOL CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) { |
| 402 return m_dwStatus & XFA_WIDGETSTATUS_Visible; | 402 return m_dwStatus & XFA_WIDGETSTATUS_Visible; |
| 403 } | 403 } |
| 404 void CXFA_FFWidget::EventKillFocus() { | 404 void CXFA_FFWidget::EventKillFocus() { |
| 405 if (m_dwStatus & XFA_WIDGETSTATUS_Access) { | 405 if (m_dwStatus & XFA_WIDGETSTATUS_Access) { |
| 406 m_dwStatus &= ~XFA_WIDGETSTATUS_Access; | 406 m_dwStatus &= ~XFA_WIDGETSTATUS_Access; |
| 407 return; | 407 return; |
| 408 } | 408 } |
| 409 CXFA_EventParam eParam; | 409 CXFA_EventParam eParam; |
| 410 eParam.m_eType = XFA_EVENT_Exit; | 410 eParam.m_eType = XFA_EVENT_Exit; |
| 411 eParam.m_pTarget = m_pDataAcc; | 411 eParam.m_pTarget = m_pDataAcc; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 476 } |
| 477 class CXFA_ImageRenderer { | 477 class CXFA_ImageRenderer { |
| 478 public: | 478 public: |
| 479 CXFA_ImageRenderer(); | 479 CXFA_ImageRenderer(); |
| 480 ~CXFA_ImageRenderer(); | 480 ~CXFA_ImageRenderer(); |
| 481 FX_BOOL Start(CFX_RenderDevice* pDevice, | 481 FX_BOOL Start(CFX_RenderDevice* pDevice, |
| 482 CFX_DIBSource* pDIBSource, | 482 CFX_DIBSource* pDIBSource, |
| 483 FX_ARGB bitmap_argb, | 483 FX_ARGB bitmap_argb, |
| 484 int bitmap_alpha, | 484 int bitmap_alpha, |
| 485 const CFX_Matrix* pImage2Device, | 485 const CFX_Matrix* pImage2Device, |
| 486 FX_DWORD flags, | 486 uint32_t flags, |
| 487 int blendType = FXDIB_BLEND_NORMAL); | 487 int blendType = FXDIB_BLEND_NORMAL); |
| 488 FX_BOOL Continue(IFX_Pause* pPause); | 488 FX_BOOL Continue(IFX_Pause* pPause); |
| 489 | 489 |
| 490 protected: | 490 protected: |
| 491 CFX_RenderDevice* m_pDevice; | 491 CFX_RenderDevice* m_pDevice; |
| 492 int m_Status; | 492 int m_Status; |
| 493 CFX_Matrix m_ImageMatrix; | 493 CFX_Matrix m_ImageMatrix; |
| 494 CFX_DIBSource* m_pDIBSource; | 494 CFX_DIBSource* m_pDIBSource; |
| 495 CFX_DIBitmap* m_pCloneConvert; | 495 CFX_DIBitmap* m_pCloneConvert; |
| 496 int m_BitmapAlpha; | 496 int m_BitmapAlpha; |
| 497 FX_ARGB m_FillArgb; | 497 FX_ARGB m_FillArgb; |
| 498 FX_DWORD m_Flags; | 498 uint32_t m_Flags; |
| 499 CFX_ImageTransformer* m_pTransformer; | 499 CFX_ImageTransformer* m_pTransformer; |
| 500 void* m_DeviceHandle; | 500 void* m_DeviceHandle; |
| 501 int32_t m_BlendType; | 501 int32_t m_BlendType; |
| 502 FX_BOOL m_Result; | 502 FX_BOOL m_Result; |
| 503 FX_BOOL m_bPrint; | 503 FX_BOOL m_bPrint; |
| 504 FX_BOOL StartDIBSource(); | 504 FX_BOOL StartDIBSource(); |
| 505 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 505 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
| 506 int left, | 506 int left, |
| 507 int top, | 507 int top, |
| 508 FX_ARGB mask_argb, | 508 FX_ARGB mask_argb, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 533 } | 533 } |
| 534 if (m_DeviceHandle) { | 534 if (m_DeviceHandle) { |
| 535 m_pDevice->CancelDIBits(m_DeviceHandle); | 535 m_pDevice->CancelDIBits(m_DeviceHandle); |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 FX_BOOL CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice, | 538 FX_BOOL CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice, |
| 539 CFX_DIBSource* pDIBSource, | 539 CFX_DIBSource* pDIBSource, |
| 540 FX_ARGB bitmap_argb, | 540 FX_ARGB bitmap_argb, |
| 541 int bitmap_alpha, | 541 int bitmap_alpha, |
| 542 const CFX_Matrix* pImage2Device, | 542 const CFX_Matrix* pImage2Device, |
| 543 FX_DWORD flags, | 543 uint32_t flags, |
| 544 int blendType) { | 544 int blendType) { |
| 545 m_pDevice = pDevice; | 545 m_pDevice = pDevice; |
| 546 m_pDIBSource = pDIBSource; | 546 m_pDIBSource = pDIBSource; |
| 547 m_FillArgb = bitmap_argb; | 547 m_FillArgb = bitmap_argb; |
| 548 m_BitmapAlpha = bitmap_alpha; | 548 m_BitmapAlpha = bitmap_alpha; |
| 549 m_ImageMatrix = *pImage2Device; | 549 m_ImageMatrix = *pImage2Device; |
| 550 m_Flags = flags; | 550 m_Flags = flags; |
| 551 m_BlendType = blendType; | 551 m_BlendType = blendType; |
| 552 return StartDIBSource(); | 552 return StartDIBSource(); |
| 553 } | 553 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 FX_BOOL bGroup = Transparency & PDFTRANS_GROUP; | 676 FX_BOOL bGroup = Transparency & PDFTRANS_GROUP; |
| 677 if (blend_mode == FXDIB_BLEND_NORMAL) { | 677 if (blend_mode == FXDIB_BLEND_NORMAL) { |
| 678 if (!pDIBitmap->IsAlphaMask()) { | 678 if (!pDIBitmap->IsAlphaMask()) { |
| 679 if (bitmap_alpha < 255) { | 679 if (bitmap_alpha < 255) { |
| 680 pDIBitmap->MultiplyAlpha(bitmap_alpha); | 680 pDIBitmap->MultiplyAlpha(bitmap_alpha); |
| 681 } | 681 } |
| 682 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { | 682 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { |
| 683 return; | 683 return; |
| 684 } | 684 } |
| 685 } else { | 685 } else { |
| 686 FX_DWORD fill_argb = (mask_argb); | 686 uint32_t fill_argb = (mask_argb); |
| 687 if (bitmap_alpha < 255) { | 687 if (bitmap_alpha < 255) { |
| 688 ((uint8_t*)&fill_argb)[3] = | 688 ((uint8_t*)&fill_argb)[3] = |
| 689 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; | 689 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; |
| 690 } | 690 } |
| 691 if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { | 691 if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) { |
| 692 return; | 692 return; |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 } | 695 } |
| 696 FX_BOOL bBackAlphaRequired = blend_mode && bIsolated; | 696 FX_BOOL bBackAlphaRequired = blend_mode && bIsolated; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 if (pStr == NULL) { | 863 if (pStr == NULL) { |
| 864 return 0; | 864 return 0; |
| 865 } | 865 } |
| 866 uint8_t* pBuffer = | 866 uint8_t* pBuffer = |
| 867 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); | 867 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); |
| 868 if (pBuffer == NULL) { | 868 if (pBuffer == NULL) { |
| 869 return 0; | 869 return 0; |
| 870 } | 870 } |
| 871 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); | 871 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); |
| 872 int32_t i = 0, j = 0; | 872 int32_t i = 0, j = 0; |
| 873 FX_DWORD dwLimb = 0; | 873 uint32_t dwLimb = 0; |
| 874 for (; i + 3 < iLen; i += 4) { | 874 for (; i + 3 < iLen; i += 4) { |
| 875 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' || | 875 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' || |
| 876 pBuffer[i + 3] == '=') { | 876 pBuffer[i + 3] == '=') { |
| 877 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') { | 877 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') { |
| 878 break; | 878 break; |
| 879 } | 879 } |
| 880 if (pBuffer[i + 2] == '=') { | 880 if (pBuffer[i + 2] == '=') { |
| 881 dwLimb = ((FX_DWORD)g_inv_base64[pBuffer[i]] << 6) | | 881 dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 6) | |
| 882 ((FX_DWORD)g_inv_base64[pBuffer[i + 1]]); | 882 ((uint32_t)g_inv_base64[pBuffer[i + 1]]); |
| 883 pOutBuffer[j] = (uint8_t)(dwLimb >> 4) & 0xFF; | 883 pOutBuffer[j] = (uint8_t)(dwLimb >> 4) & 0xFF; |
| 884 j++; | 884 j++; |
| 885 } else { | 885 } else { |
| 886 dwLimb = ((FX_DWORD)g_inv_base64[pBuffer[i]] << 12) | | 886 dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 12) | |
| 887 ((FX_DWORD)g_inv_base64[pBuffer[i + 1]] << 6) | | 887 ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 6) | |
| 888 ((FX_DWORD)g_inv_base64[pBuffer[i + 2]]); | 888 ((uint32_t)g_inv_base64[pBuffer[i + 2]]); |
| 889 pOutBuffer[j] = (uint8_t)(dwLimb >> 10) & 0xFF; | 889 pOutBuffer[j] = (uint8_t)(dwLimb >> 10) & 0xFF; |
| 890 pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 2) & 0xFF; | 890 pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 2) & 0xFF; |
| 891 j += 2; | 891 j += 2; |
| 892 } | 892 } |
| 893 } else { | 893 } else { |
| 894 dwLimb = ((FX_DWORD)g_inv_base64[pBuffer[i]] << 18) | | 894 dwLimb = ((uint32_t)g_inv_base64[pBuffer[i]] << 18) | |
| 895 ((FX_DWORD)g_inv_base64[pBuffer[i + 1]] << 12) | | 895 ((uint32_t)g_inv_base64[pBuffer[i + 1]] << 12) | |
| 896 ((FX_DWORD)g_inv_base64[pBuffer[i + 2]] << 6) | | 896 ((uint32_t)g_inv_base64[pBuffer[i + 2]] << 6) | |
| 897 ((FX_DWORD)g_inv_base64[pBuffer[i + 3]]); | 897 ((uint32_t)g_inv_base64[pBuffer[i + 3]]); |
| 898 pOutBuffer[j] = (uint8_t)(dwLimb >> 16) & 0xff; | 898 pOutBuffer[j] = (uint8_t)(dwLimb >> 16) & 0xff; |
| 899 pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 8) & 0xff; | 899 pOutBuffer[j + 1] = (uint8_t)(dwLimb >> 8) & 0xff; |
| 900 pOutBuffer[j + 2] = (uint8_t)(dwLimb)&0xff; | 900 pOutBuffer[j + 2] = (uint8_t)(dwLimb)&0xff; |
| 901 j += 3; | 901 j += 3; |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 FX_Free(pBuffer); | 904 FX_Free(pBuffer); |
| 905 return j; | 905 return j; |
| 906 } | 906 } |
| 907 | 907 |
| 908 static const FX_CHAR g_base64_chars[] = | 908 static const FX_CHAR g_base64_chars[] = |
| 909 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 909 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
| 910 | 910 |
| 911 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { | 911 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { |
| 912 FX_CHAR* out = NULL; | 912 FX_CHAR* out = NULL; |
| 913 int i, j; | 913 int i, j; |
| 914 FX_DWORD limb; | 914 uint32_t limb; |
| 915 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); | 915 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); |
| 916 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { | 916 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { |
| 917 limb = ((FX_DWORD)buf[i] << 16) | ((FX_DWORD)buf[i + 1] << 8) | | 917 limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | |
| 918 ((FX_DWORD)buf[i + 2]); | 918 ((uint32_t)buf[i + 2]); |
| 919 out[j] = g_base64_chars[(limb >> 18) & 63]; | 919 out[j] = g_base64_chars[(limb >> 18) & 63]; |
| 920 out[j + 1] = g_base64_chars[(limb >> 12) & 63]; | 920 out[j + 1] = g_base64_chars[(limb >> 12) & 63]; |
| 921 out[j + 2] = g_base64_chars[(limb >> 6) & 63]; | 921 out[j + 2] = g_base64_chars[(limb >> 6) & 63]; |
| 922 out[j + 3] = g_base64_chars[(limb)&63]; | 922 out[j + 3] = g_base64_chars[(limb)&63]; |
| 923 } | 923 } |
| 924 switch (buf_len - i) { | 924 switch (buf_len - i) { |
| 925 case 0: | 925 case 0: |
| 926 break; | 926 break; |
| 927 case 1: | 927 case 1: |
| 928 limb = ((FX_DWORD)buf[i]); | 928 limb = ((uint32_t)buf[i]); |
| 929 out[j++] = g_base64_chars[(limb >> 2) & 63]; | 929 out[j++] = g_base64_chars[(limb >> 2) & 63]; |
| 930 out[j++] = g_base64_chars[(limb << 4) & 63]; | 930 out[j++] = g_base64_chars[(limb << 4) & 63]; |
| 931 out[j++] = '='; | 931 out[j++] = '='; |
| 932 out[j++] = '='; | 932 out[j++] = '='; |
| 933 break; | 933 break; |
| 934 case 2: | 934 case 2: |
| 935 limb = ((FX_DWORD)buf[i] << 8) | ((FX_DWORD)buf[i + 1]); | 935 limb = ((uint32_t)buf[i] << 8) | ((uint32_t)buf[i + 1]); |
| 936 out[j++] = g_base64_chars[(limb >> 10) & 63]; | 936 out[j++] = g_base64_chars[(limb >> 10) & 63]; |
| 937 out[j++] = g_base64_chars[(limb >> 4) & 63]; | 937 out[j++] = g_base64_chars[(limb >> 4) & 63]; |
| 938 out[j++] = g_base64_chars[(limb << 2) & 63]; | 938 out[j++] = g_base64_chars[(limb << 2) & 63]; |
| 939 out[j++] = '='; | 939 out[j++] = '='; |
| 940 break; | 940 break; |
| 941 default: | 941 default: |
| 942 break; | 942 break; |
| 943 } | 943 } |
| 944 out[j] = '\0'; | 944 out[j] = '\0'; |
| 945 return out; | 945 return out; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 } | 1113 } |
| 1114 return nullptr; | 1114 return nullptr; |
| 1115 } | 1115 } |
| 1116 FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType) { | 1116 FX_BOOL XFA_IsCreateWidget(XFA_ELEMENT iType) { |
| 1117 return iType == XFA_ELEMENT_Field || iType == XFA_ELEMENT_Draw || | 1117 return iType == XFA_ELEMENT_Field || iType == XFA_ELEMENT_Draw || |
| 1118 iType == XFA_ELEMENT_Subform || iType == XFA_ELEMENT_ExclGroup; | 1118 iType == XFA_ELEMENT_Subform || iType == XFA_ELEMENT_ExclGroup; |
| 1119 } | 1119 } |
| 1120 static void XFA_BOX_GetPath_Arc(CXFA_Box box, | 1120 static void XFA_BOX_GetPath_Arc(CXFA_Box box, |
| 1121 CFX_RectF rtDraw, | 1121 CFX_RectF rtDraw, |
| 1122 CFX_Path& fillPath, | 1122 CFX_Path& fillPath, |
| 1123 FX_DWORD dwFlags) { | 1123 uint32_t dwFlags) { |
| 1124 FX_FLOAT a, b; | 1124 FX_FLOAT a, b; |
| 1125 a = rtDraw.width / 2.0f; | 1125 a = rtDraw.width / 2.0f; |
| 1126 b = rtDraw.height / 2.0f; | 1126 b = rtDraw.height / 2.0f; |
| 1127 if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { | 1127 if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { |
| 1128 a = b = std::min(a, b); | 1128 a = b = std::min(a, b); |
| 1129 } | 1129 } |
| 1130 CFX_PointF center = rtDraw.Center(); | 1130 CFX_PointF center = rtDraw.Center(); |
| 1131 rtDraw.left = center.x - a; | 1131 rtDraw.left = center.x - a; |
| 1132 rtDraw.top = center.y - b; | 1132 rtDraw.top = center.y - b; |
| 1133 rtDraw.width = a + a; | 1133 rtDraw.width = a + a; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 CFX_Shading shading(ptStart, ptEnd, FALSE, FALSE, crStart, crEnd); | 1545 CFX_Shading shading(ptStart, ptEnd, FALSE, FALSE, crStart, crEnd); |
| 1546 CFX_Color cr(&shading); | 1546 CFX_Color cr(&shading); |
| 1547 pGS->SetFillColor(&cr); | 1547 pGS->SetFillColor(&cr); |
| 1548 pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix); | 1548 pGS->FillPath(&fillPath, FXFILL_WINDING, pMatrix); |
| 1549 } | 1549 } |
| 1550 static void XFA_BOX_Fill(CXFA_Box box, | 1550 static void XFA_BOX_Fill(CXFA_Box box, |
| 1551 const CXFA_StrokeArray& strokes, | 1551 const CXFA_StrokeArray& strokes, |
| 1552 CFX_Graphics* pGS, | 1552 CFX_Graphics* pGS, |
| 1553 const CFX_RectF& rtWidget, | 1553 const CFX_RectF& rtWidget, |
| 1554 CFX_Matrix* pMatrix, | 1554 CFX_Matrix* pMatrix, |
| 1555 FX_DWORD dwFlags) { | 1555 uint32_t dwFlags) { |
| 1556 CXFA_Fill fill = box.GetFill(); | 1556 CXFA_Fill fill = box.GetFill(); |
| 1557 if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { | 1557 if (!fill || fill.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { |
| 1558 return; | 1558 return; |
| 1559 } | 1559 } |
| 1560 pGS->SaveGraphState(); | 1560 pGS->SaveGraphState(); |
| 1561 CFX_Path fillPath; | 1561 CFX_Path fillPath; |
| 1562 fillPath.Create(); | 1562 fillPath.Create(); |
| 1563 XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath, | 1563 XFA_BOX_GetFillPath(box, strokes, rtWidget, fillPath, |
| 1564 (dwFlags & XFA_DRAWBOX_ForceRound) != 0); | 1564 (dwFlags & XFA_DRAWBOX_ForceRound) != 0); |
| 1565 fillPath.Close(); | 1565 fillPath.Close(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 XFA_ATTRIBUTEENUM_Butt); | 1616 XFA_ATTRIBUTEENUM_Butt); |
| 1617 CFX_Color fxColor(stroke.GetColor()); | 1617 CFX_Color fxColor(stroke.GetColor()); |
| 1618 pGS->SetStrokeColor(&fxColor); | 1618 pGS->SetStrokeColor(&fxColor); |
| 1619 pGS->StrokePath(pPath, pMatrix); | 1619 pGS->StrokePath(pPath, pMatrix); |
| 1620 pGS->RestoreGraphState(); | 1620 pGS->RestoreGraphState(); |
| 1621 } | 1621 } |
| 1622 static void XFA_BOX_StrokeArc(CXFA_Box box, | 1622 static void XFA_BOX_StrokeArc(CXFA_Box box, |
| 1623 CFX_Graphics* pGS, | 1623 CFX_Graphics* pGS, |
| 1624 CFX_RectF rtWidget, | 1624 CFX_RectF rtWidget, |
| 1625 CFX_Matrix* pMatrix, | 1625 CFX_Matrix* pMatrix, |
| 1626 FX_DWORD dwFlags) { | 1626 uint32_t dwFlags) { |
| 1627 CXFA_Edge edge = box.GetEdge(0); | 1627 CXFA_Edge edge = box.GetEdge(0); |
| 1628 if (!edge || !edge.IsVisible()) { | 1628 if (!edge || !edge.IsVisible()) { |
| 1629 return; | 1629 return; |
| 1630 } | 1630 } |
| 1631 FX_BOOL bVisible = FALSE; | 1631 FX_BOOL bVisible = FALSE; |
| 1632 FX_FLOAT fThickness = 0; | 1632 FX_FLOAT fThickness = 0; |
| 1633 int32_t i3DType = box.Get3DStyle(bVisible, fThickness); | 1633 int32_t i3DType = box.Get3DStyle(bVisible, fThickness); |
| 1634 if (i3DType) { | 1634 if (i3DType) { |
| 1635 if (bVisible && fThickness >= 0.001f) { | 1635 if (bVisible && fThickness >= 0.001f) { |
| 1636 dwFlags |= XFA_DRAWBOX_Lowered3D; | 1636 dwFlags |= XFA_DRAWBOX_Lowered3D; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 path.Close(); | 1876 path.Close(); |
| 1877 } | 1877 } |
| 1878 XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix); | 1878 XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix); |
| 1879 } | 1879 } |
| 1880 } | 1880 } |
| 1881 static void XFA_BOX_Stroke(CXFA_Box box, | 1881 static void XFA_BOX_Stroke(CXFA_Box box, |
| 1882 const CXFA_StrokeArray& strokes, | 1882 const CXFA_StrokeArray& strokes, |
| 1883 CFX_Graphics* pGS, | 1883 CFX_Graphics* pGS, |
| 1884 CFX_RectF rtWidget, | 1884 CFX_RectF rtWidget, |
| 1885 CFX_Matrix* pMatrix, | 1885 CFX_Matrix* pMatrix, |
| 1886 FX_DWORD dwFlags) { | 1886 uint32_t dwFlags) { |
| 1887 if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { | 1887 if (box.IsArc() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { |
| 1888 XFA_BOX_StrokeArc(box, pGS, rtWidget, pMatrix, dwFlags); | 1888 XFA_BOX_StrokeArc(box, pGS, rtWidget, pMatrix, dwFlags); |
| 1889 return; | 1889 return; |
| 1890 } | 1890 } |
| 1891 bool bVisible = false; | 1891 bool bVisible = false; |
| 1892 for (int32_t j = 0; j < 4; j++) { | 1892 for (int32_t j = 0; j < 4; j++) { |
| 1893 if (strokes[j * 2 + 1].IsVisible()) { | 1893 if (strokes[j * 2 + 1].IsVisible()) { |
| 1894 bVisible = true; | 1894 bVisible = true; |
| 1895 break; | 1895 break; |
| 1896 } | 1896 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 } | 1940 } |
| 1941 break; | 1941 break; |
| 1942 } | 1942 } |
| 1943 } | 1943 } |
| 1944 XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix); | 1944 XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix); |
| 1945 } | 1945 } |
| 1946 void XFA_DrawBox(CXFA_Box box, | 1946 void XFA_DrawBox(CXFA_Box box, |
| 1947 CFX_Graphics* pGS, | 1947 CFX_Graphics* pGS, |
| 1948 const CFX_RectF& rtWidget, | 1948 const CFX_RectF& rtWidget, |
| 1949 CFX_Matrix* pMatrix, | 1949 CFX_Matrix* pMatrix, |
| 1950 FX_DWORD dwFlags) { | 1950 uint32_t dwFlags) { |
| 1951 if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { | 1951 if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { |
| 1952 return; | 1952 return; |
| 1953 } | 1953 } |
| 1954 int32_t iType = box.GetClassID(); | 1954 int32_t iType = box.GetClassID(); |
| 1955 if (iType != XFA_ELEMENT_Arc && iType != XFA_ELEMENT_Border && | 1955 if (iType != XFA_ELEMENT_Arc && iType != XFA_ELEMENT_Border && |
| 1956 iType != XFA_ELEMENT_Rectangle) { | 1956 iType != XFA_ELEMENT_Rectangle) { |
| 1957 return; | 1957 return; |
| 1958 } | 1958 } |
| 1959 CXFA_StrokeArray strokes; | 1959 CXFA_StrokeArray strokes; |
| 1960 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { | 1960 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { |
| 1961 box.GetStrokes(strokes); | 1961 box.GetStrokes(strokes); |
| 1962 } | 1962 } |
| 1963 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1963 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
| 1964 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1964 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
| 1965 } | 1965 } |
| OLD | NEW |