| 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 25 matching lines...) Expand all Loading... |
| 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 pContext->m_pDevice = new CFX_FxgeDevice; |
| 46 CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap); |
| 46 if (flags & FPDF_REVERSE_BYTE_ORDER) { | 47 if (flags & FPDF_REVERSE_BYTE_ORDER) { |
| 47 ((CFX_FxgeDevice*)pContext->m_pDevice) | 48 ((CFX_FxgeDevice*)pContext->m_pDevice) |
| 48 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); | 49 ->AttachEx(pBitmap, true, nullptr, false); |
| 49 } else { | 50 } else { |
| 50 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); | 51 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach(pBitmap); |
| 51 } | 52 } |
| 52 | 53 |
| 53 IFSDK_PAUSE_Adapter IPauseAdapter(pause); | 54 IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
| 54 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, | 55 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
| 55 rotate, flags, FALSE, &IPauseAdapter); | 56 rotate, flags, FALSE, &IPauseAdapter); |
| 56 | 57 |
| 57 if (pContext->m_pRenderer) { | 58 if (pContext->m_pRenderer) { |
| 58 return CPDF_ProgressiveRenderer::ToFPDFStatus( | 59 return CPDF_ProgressiveRenderer::ToFPDFStatus( |
| 59 pContext->m_pRenderer->GetStatus()); | 60 pContext->m_pRenderer->GetStatus()); |
| 60 } | 61 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 87 return; | 88 return; |
| 88 | 89 |
| 89 CRenderContext* pContext = | 90 CRenderContext* pContext = |
| 90 static_cast<CRenderContext*>(pPage->GetRenderContext()); | 91 static_cast<CRenderContext*>(pPage->GetRenderContext()); |
| 91 if (!pContext) | 92 if (!pContext) |
| 92 return; | 93 return; |
| 93 | 94 |
| 94 pContext->m_pDevice->RestoreState(false); | 95 pContext->m_pDevice->RestoreState(false); |
| 95 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>()); | 96 pPage->SetRenderContext(std::unique_ptr<CFX_Deletable>()); |
| 96 } | 97 } |
| OLD | NEW |