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 | 8 |
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
10 #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" | 10 #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 IFSDK_PAUSE* pause) { | 35 IFSDK_PAUSE* pause) { |
36 if (!bitmap || !pause || pause->version != 1) | 36 if (!bitmap || !pause || pause->version != 1) |
37 return FPDF_RENDER_FAILED; | 37 return FPDF_RENDER_FAILED; |
38 | 38 |
39 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 39 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
40 if (!pPage) | 40 if (!pPage) |
41 return FPDF_RENDER_FAILED; | 41 return FPDF_RENDER_FAILED; |
42 | 42 |
43 CRenderContext* pContext = new CRenderContext; | 43 CRenderContext* pContext = new CRenderContext; |
44 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>(pContext)); | 44 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>(pContext)); |
45 pContext->m_pDevice = new CFX_FxgeDevice; | 45 CFX_FxgeDevice* pDevice = new CFX_FxgeDevice; |
46 if (flags & FPDF_REVERSE_BYTE_ORDER) { | 46 pContext->m_pDevice = pDevice; |
47 ((CFX_FxgeDevice*)pContext->m_pDevice) | 47 CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap); |
48 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); | 48 pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); |
49 } else { | |
50 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); | |
51 } | |
52 | 49 |
53 IFSDK_PAUSE_Adapter IPauseAdapter(pause); | 50 IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
54 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, | 51 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
55 rotate, flags, FALSE, &IPauseAdapter); | 52 rotate, flags, FALSE, &IPauseAdapter); |
56 | 53 |
57 if (pContext->m_pRenderer) { | 54 if (pContext->m_pRenderer) { |
58 return CPDF_ProgressiveRenderer::ToFPDFStatus( | 55 return CPDF_ProgressiveRenderer::ToFPDFStatus( |
59 pContext->m_pRenderer->GetStatus()); | 56 pContext->m_pRenderer->GetStatus()); |
60 } | 57 } |
61 return FPDF_RENDER_FAILED; | 58 return FPDF_RENDER_FAILED; |
(...skipping 25 matching lines...) Expand all Loading... |
87 return; | 84 return; |
88 | 85 |
89 CRenderContext* pContext = | 86 CRenderContext* pContext = |
90 static_cast<CRenderContext*>(pPage->GetRenderContext()); | 87 static_cast<CRenderContext*>(pPage->GetRenderContext()); |
91 if (!pContext) | 88 if (!pContext) |
92 return; | 89 return; |
93 | 90 |
94 pContext->m_pDevice->RestoreState(false); | 91 pContext->m_pDevice->RestoreState(false); |
95 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>()); | 92 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>()); |
96 } | 93 } |
OLD | NEW |