| 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 23 matching lines...) Expand all Loading... |
| 34 IFSDK_PAUSE* pause) { | 34 IFSDK_PAUSE* pause) { |
| 35 if (!bitmap || !pause || pause->version != 1) | 35 if (!bitmap || !pause || pause->version != 1) |
| 36 return FPDF_RENDER_FAILED; | 36 return FPDF_RENDER_FAILED; |
| 37 | 37 |
| 38 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 38 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 39 if (!pPage) | 39 if (!pPage) |
| 40 return FPDF_RENDER_FAILED; | 40 return FPDF_RENDER_FAILED; |
| 41 | 41 |
| 42 CRenderContext* pContext = new CRenderContext; | 42 CRenderContext* pContext = new CRenderContext; |
| 43 pPage->SetPrivateData((void*)1, pContext, DropContext); | 43 pPage->SetPrivateData((void*)1, pContext, DropContext); |
| 44 #ifdef _SKIA_SUPPORT_ | |
| 45 pContext->m_pDevice = new CFX_SkiaDevice; | |
| 46 if (flags & FPDF_REVERSE_BYTE_ORDER) | |
| 47 ((CFX_SkiaDevice*)pContext->m_pDevice) | |
| 48 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); | |
| 49 else | |
| 50 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); | |
| 51 #else | |
| 52 pContext->m_pDevice = new CFX_FxgeDevice; | 44 pContext->m_pDevice = new CFX_FxgeDevice; |
| 53 if (flags & FPDF_REVERSE_BYTE_ORDER) | 45 if (flags & FPDF_REVERSE_BYTE_ORDER) |
| 54 ((CFX_FxgeDevice*)pContext->m_pDevice) | 46 ((CFX_FxgeDevice*)pContext->m_pDevice) |
| 55 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); | 47 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE); |
| 56 else | 48 else |
| 57 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); | 49 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap); |
| 58 #endif | |
| 59 IFSDK_PAUSE_Adapter IPauseAdapter(pause); | 50 IFSDK_PAUSE_Adapter IPauseAdapter(pause); |
| 60 | 51 |
| 61 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, | 52 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, |
| 62 rotate, flags, FALSE, &IPauseAdapter); | 53 rotate, flags, FALSE, &IPauseAdapter); |
| 63 | 54 |
| 64 if (pContext->m_pRenderer) { | 55 if (pContext->m_pRenderer) { |
| 65 return CPDF_ProgressiveRenderer::ToFPDFStatus( | 56 return CPDF_ProgressiveRenderer::ToFPDFStatus( |
| 66 pContext->m_pRenderer->GetStatus()); | 57 pContext->m_pRenderer->GetStatus()); |
| 67 } | 58 } |
| 68 return FPDF_RENDER_FAILED; | 59 return FPDF_RENDER_FAILED; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 93 return; | 84 return; |
| 94 | 85 |
| 95 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); | 86 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1); |
| 96 if (!pContext) | 87 if (!pContext) |
| 97 return; | 88 return; |
| 98 | 89 |
| 99 pContext->m_pDevice->RestoreState(); | 90 pContext->m_pDevice->RestoreState(); |
| 100 delete pContext; | 91 delete pContext; |
| 101 pPage->RemovePrivateData((void*)1); | 92 pPage->RemovePrivateData((void*)1); |
| 102 } | 93 } |
| OLD | NEW |