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 "../../public/fpdf_progressive.h" | 7 #include "../../public/fpdf_progressive.h" |
8 #include "../../public/fpdfview.h" | 8 #include "../../public/fpdfview.h" |
9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 #include "../include/fsdk_rendercontext.h" | 10 #include "../include/fsdk_rendercontext.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 if (!pause) | 26 if (!pause) |
27 return FPDF_RENDER_FAILED; | 27 return FPDF_RENDER_FAILED; |
28 | 28 |
29 if (pause->version != 1) | 29 if (pause->version != 1) |
30 return FPDF_RENDER_FAILED; | 30 return FPDF_RENDER_FAILED; |
31 | 31 |
32 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | 32 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); |
33 if (!pPage) | 33 if (!pPage) |
34 return FPDF_RENDER_FAILED; | 34 return FPDF_RENDER_FAILED; |
35 | 35 |
36 // FXMT_CSLOCK_OBJ(&pPage->m_PageLock); | |
37 | |
38 CRenderContext* pContext = new CRenderContext; | 36 CRenderContext* pContext = new CRenderContext; |
39 pPage->SetPrivateData((void*)1, pContext, DropContext); | 37 pPage->SetPrivateData((void*)1, pContext, DropContext); |
40 #ifdef _SKIA_SUPPORT_ | 38 #ifdef _SKIA_SUPPORT_ |
41 pContext->m_pDevice = new CFX_SkiaDevice; | 39 pContext->m_pDevice = new CFX_SkiaDevice; |
42 if (flags & FPDF_REVERSE_BYTE_ORDER) | 40 if (flags & FPDF_REVERSE_BYTE_ORDER) |
43 ((CFX_SkiaDevice*)pContext->m_pDevice) | 41 ((CFX_SkiaDevice*)pContext->m_pDevice) |
44 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); | 42 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); |
45 else | 43 else |
46 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); | 44 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); |
47 #else | 45 #else |
(...skipping 26 matching lines...) Expand all Loading... |
74 if (!pause) | 72 if (!pause) |
75 return FPDF_RENDER_FAILED; | 73 return FPDF_RENDER_FAILED; |
76 | 74 |
77 if (pause->version != 1) | 75 if (pause->version != 1) |
78 return FPDF_RENDER_FAILED; | 76 return FPDF_RENDER_FAILED; |
79 | 77 |
80 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | 78 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); |
81 if (!pPage) | 79 if (!pPage) |
82 return FPDF_RENDER_FAILED; | 80 return FPDF_RENDER_FAILED; |
83 | 81 |
84 // FXMT_CSLOCK_OBJ(&pPage->m_PageLock); | |
85 | |
86 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); | 82 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); |
87 if (pContext && pContext->m_pRenderer) { | 83 if (pContext && pContext->m_pRenderer) { |
88 IFSDK_PAUSE_Adapter IPauseAdapter(pause); | 84 IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
89 pContext->m_pRenderer->Continue(&IPauseAdapter); | 85 pContext->m_pRenderer->Continue(&IPauseAdapter); |
90 | 86 |
91 CPDF_ProgressiveRenderer::RenderStatus status = | 87 CPDF_ProgressiveRenderer::RenderStatus status = |
92 CPDF_ProgressiveRenderer::Failed; | 88 CPDF_ProgressiveRenderer::Failed; |
93 status = pContext->m_pRenderer->GetStatus(); | 89 status = pContext->m_pRenderer->GetStatus(); |
94 return status; | 90 return status; |
95 } | 91 } |
96 return FPDF_RENDER_FAILED; | 92 return FPDF_RENDER_FAILED; |
97 } | 93 } |
98 | 94 |
99 DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) { | 95 DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) { |
100 if (page == NULL) | 96 if (!page) |
101 return; | 97 return; |
102 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | 98 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); |
103 if (!pPage) | 99 if (!pPage) |
104 return; | 100 return; |
105 | 101 |
106 //» FXMT_CSLOCK_OBJ(&pPage->m_PageLock); | 102 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); |
| 103 if (!pContext) |
| 104 return; |
107 | 105 |
108 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); | 106 pContext->m_pDevice->RestoreState(); |
109 if (pContext) { | 107 delete pContext; |
110 pContext->m_pDevice->RestoreState(); | 108 pPage->RemovePrivateData((void*)1); |
111 delete pContext; | |
112 pPage->RemovePrivateData((void*)1); | |
113 } | |
114 } | 109 } |
OLD | NEW |