| 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/fde/fde_iterator.h" | 7 #include "xfa/fde/fde_iterator.h" |
| 8 | 8 |
| 9 #include "xfa/fgas/crt/fgas_utils.h" | 9 #include "xfa/fgas/crt/fgas_utils.h" |
| 10 | 10 |
| 11 IFDE_VisualSetIterator* IFDE_VisualSetIterator::Create() { | 11 IFDE_VisualSetIterator* IFDE_VisualSetIterator::Create() { |
| 12 return new CFDE_VisualSetIterator; | 12 return new CFDE_VisualSetIterator; |
| 13 } | 13 } |
| 14 CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} | 14 CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} |
| 15 CFDE_VisualSetIterator::~CFDE_VisualSetIterator() { | 15 CFDE_VisualSetIterator::~CFDE_VisualSetIterator() { |
| 16 m_CanvasStack.RemoveAll(); | 16 m_CanvasStack.RemoveAll(); |
| 17 } | 17 } |
| 18 FX_BOOL CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { | 18 FX_BOOL CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { |
| 19 FXSYS_assert(pCanvas != NULL); | 19 FXSYS_assert(pCanvas != NULL); |
| 20 m_CanvasStack.RemoveAll(); | 20 m_CanvasStack.RemoveAll(); |
| 21 FDE_CANVASITEM canvas; | 21 FDE_CANVASITEM canvas; |
| 22 canvas.hCanvas = NULL; | 22 canvas.hCanvas = NULL; |
| 23 canvas.pCanvas = pCanvas; | 23 canvas.pCanvas = pCanvas; |
| 24 canvas.hPos = pCanvas->GetFirstPosition(NULL); | 24 canvas.hPos = pCanvas->GetFirstPosition(NULL); |
| 25 if (canvas.hPos == NULL) { | 25 if (canvas.hPos == NULL) { |
| 26 return FALSE; | 26 return FALSE; |
| 27 } | 27 } |
| 28 return m_CanvasStack.Push(canvas) == 0; | 28 return m_CanvasStack.Push(canvas) == 0; |
| 29 } | 29 } |
| 30 FX_BOOL CFDE_VisualSetIterator::FilterObjects(FX_DWORD dwObjects) { | 30 FX_BOOL CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { |
| 31 if (m_CanvasStack.GetSize() == 0) { | 31 if (m_CanvasStack.GetSize() == 0) { |
| 32 return FALSE; | 32 return FALSE; |
| 33 } | 33 } |
| 34 while (m_CanvasStack.GetSize() > 1) { | 34 while (m_CanvasStack.GetSize() > 1) { |
| 35 m_CanvasStack.Pop(); | 35 m_CanvasStack.Pop(); |
| 36 } | 36 } |
| 37 m_dwFilter = dwObjects & ~(FX_DWORD)FDE_VISUALOBJ_Widget; | 37 m_dwFilter = dwObjects & ~(uint32_t)FDE_VISUALOBJ_Widget; |
| 38 if (dwObjects & FDE_VISUALOBJ_Widget) { | 38 if (dwObjects & FDE_VISUALOBJ_Widget) { |
| 39 m_dwFilter |= 0xFF00; | 39 m_dwFilter |= 0xFF00; |
| 40 } | 40 } |
| 41 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); | 41 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); |
| 42 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL); | 42 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL); |
| 43 pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(NULL); | 43 pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(NULL); |
| 44 return pCanvas->hPos != NULL; | 44 return pCanvas->hPos != NULL; |
| 45 } | 45 } |
| 46 void CFDE_VisualSetIterator::Reset() { | 46 void CFDE_VisualSetIterator::Reset() { |
| 47 FilterObjects(m_dwFilter); | 47 FilterObjects(m_dwFilter); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 FXSYS_assert(hObj != NULL); | 65 FXSYS_assert(hObj != NULL); |
| 66 FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); | 66 FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); |
| 67 if (eType == FDE_VISUALOBJ_Canvas) { | 67 if (eType == FDE_VISUALOBJ_Canvas) { |
| 68 FDE_CANVASITEM canvas; | 68 FDE_CANVASITEM canvas; |
| 69 canvas.hCanvas = hObj; | 69 canvas.hCanvas = hObj; |
| 70 canvas.pCanvas = (IFDE_CanvasSet*)pVisualSet; | 70 canvas.pCanvas = (IFDE_CanvasSet*)pVisualSet; |
| 71 canvas.hPos = canvas.pCanvas->GetFirstPosition(hObj); | 71 canvas.hPos = canvas.pCanvas->GetFirstPosition(hObj); |
| 72 m_CanvasStack.Push(canvas); | 72 m_CanvasStack.Push(canvas); |
| 73 break; | 73 break; |
| 74 } | 74 } |
| 75 FX_DWORD dwObj = | 75 uint32_t dwObj = |
| 76 (eType == FDE_VISUALOBJ_Widget) | 76 (eType == FDE_VISUALOBJ_Widget) |
| 77 ? (FX_DWORD)((IFDE_WidgetSet*)pVisualSet)->GetWidgetType(hObj) | 77 ? (uint32_t)((IFDE_WidgetSet*)pVisualSet)->GetWidgetType(hObj) |
| 78 : (FX_DWORD)eType; | 78 : (uint32_t)eType; |
| 79 if ((m_dwFilter & dwObj) != 0) { | 79 if ((m_dwFilter & dwObj) != 0) { |
| 80 if (ppCanvasSet) { | 80 if (ppCanvasSet) { |
| 81 *ppCanvasSet = pCanvas->pCanvas; | 81 *ppCanvasSet = pCanvas->pCanvas; |
| 82 } | 82 } |
| 83 if (phCanvasObj) { | 83 if (phCanvasObj) { |
| 84 *phCanvasObj = pCanvas->hCanvas; | 84 *phCanvasObj = pCanvas->hCanvas; |
| 85 } | 85 } |
| 86 return hObj; | 86 return hObj; |
| 87 } | 87 } |
| 88 } while (pCanvas->hPos != NULL); | 88 } while (pCanvas->hPos != NULL); |
| 89 } | 89 } |
| 90 if (ppCanvasSet) { | 90 if (ppCanvasSet) { |
| 91 *ppCanvasSet = NULL; | 91 *ppCanvasSet = NULL; |
| 92 } | 92 } |
| 93 if (phCanvasObj) { | 93 if (phCanvasObj) { |
| 94 *phCanvasObj = NULL; | 94 *phCanvasObj = NULL; |
| 95 } | 95 } |
| 96 pVisualSet = NULL; | 96 pVisualSet = NULL; |
| 97 return NULL; | 97 return NULL; |
| 98 } | 98 } |
| OLD | NEW |