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 |
(...skipping 10 matching lines...) Expand all Loading... |
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(uint32_t 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 & ~(uint32_t)FDE_VISUALOBJ_Widget; | 37 m_dwFilter = dwObjects; |
38 if (dwObjects & FDE_VISUALOBJ_Widget) { | 38 |
39 m_dwFilter |= 0xFF00; | |
40 } | |
41 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); | 39 FDE_CANVASITEM* pCanvas = m_CanvasStack.GetTopElement(); |
42 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL); | 40 FXSYS_assert(pCanvas != NULL && pCanvas->pCanvas != NULL); |
43 pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(NULL); | 41 pCanvas->hPos = pCanvas->pCanvas->GetFirstPosition(NULL); |
44 return pCanvas->hPos != NULL; | 42 return pCanvas->hPos != NULL; |
45 } | 43 } |
46 void CFDE_VisualSetIterator::Reset() { | 44 void CFDE_VisualSetIterator::Reset() { |
47 FilterObjects(m_dwFilter); | 45 FilterObjects(m_dwFilter); |
48 } | 46 } |
49 FDE_HVISUALOBJ CFDE_VisualSetIterator::GetNext(IFDE_VisualSet*& pVisualSet, | 47 FDE_HVISUALOBJ CFDE_VisualSetIterator::GetNext(IFDE_VisualSet*& pVisualSet, |
50 FDE_HVISUALOBJ* phCanvasObj, | 48 FDE_HVISUALOBJ* phCanvasObj, |
(...skipping 14 matching lines...) Expand all Loading... |
65 FXSYS_assert(hObj != NULL); | 63 FXSYS_assert(hObj != NULL); |
66 FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); | 64 FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); |
67 if (eType == FDE_VISUALOBJ_Canvas) { | 65 if (eType == FDE_VISUALOBJ_Canvas) { |
68 FDE_CANVASITEM canvas; | 66 FDE_CANVASITEM canvas; |
69 canvas.hCanvas = hObj; | 67 canvas.hCanvas = hObj; |
70 canvas.pCanvas = (IFDE_CanvasSet*)pVisualSet; | 68 canvas.pCanvas = (IFDE_CanvasSet*)pVisualSet; |
71 canvas.hPos = canvas.pCanvas->GetFirstPosition(hObj); | 69 canvas.hPos = canvas.pCanvas->GetFirstPosition(hObj); |
72 m_CanvasStack.Push(canvas); | 70 m_CanvasStack.Push(canvas); |
73 break; | 71 break; |
74 } | 72 } |
75 uint32_t dwObj = | 73 uint32_t dwObj = (uint32_t)eType; |
76 (eType == FDE_VISUALOBJ_Widget) | |
77 ? (uint32_t)((IFDE_WidgetSet*)pVisualSet)->GetWidgetType(hObj) | |
78 : (uint32_t)eType; | |
79 if ((m_dwFilter & dwObj) != 0) { | 74 if ((m_dwFilter & dwObj) != 0) { |
80 if (ppCanvasSet) { | 75 if (ppCanvasSet) { |
81 *ppCanvasSet = pCanvas->pCanvas; | 76 *ppCanvasSet = pCanvas->pCanvas; |
82 } | 77 } |
83 if (phCanvasObj) { | 78 if (phCanvasObj) { |
84 *phCanvasObj = pCanvas->hCanvas; | 79 *phCanvasObj = pCanvas->hCanvas; |
85 } | 80 } |
86 return hObj; | 81 return hObj; |
87 } | 82 } |
88 } while (pCanvas->hPos != NULL); | 83 } while (pCanvas->hPos != NULL); |
89 } | 84 } |
90 if (ppCanvasSet) { | 85 if (ppCanvasSet) { |
91 *ppCanvasSet = NULL; | 86 *ppCanvasSet = NULL; |
92 } | 87 } |
93 if (phCanvasObj) { | 88 if (phCanvasObj) { |
94 *phCanvasObj = NULL; | 89 *phCanvasObj = NULL; |
95 } | 90 } |
96 pVisualSet = NULL; | 91 pVisualSet = NULL; |
97 return NULL; | 92 return NULL; |
98 } | 93 } |
OLD | NEW |