Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: fpdfsdk/src/fpdf_progressive.cpp

Issue 1799773002: Move fpdfsdk/src up to fpdfsdk/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdf_flatten.cpp ('k') | fpdfsdk/src/fpdf_searchex.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "public/fpdf_progressive.h"
8
9 #include "fpdfsdk/include/fsdk_define.h"
10 #include "fpdfsdk/include/fsdk_rendercontext.h"
11 #include "public/fpdfview.h"
12
13 // These checks are here because core/ and public/ cannot depend on each other.
14 static_assert(CPDF_ProgressiveRenderer::Ready == FPDF_RENDER_READER,
15 "CPDF_ProgressiveRenderer::Ready value mismatch");
16 static_assert(CPDF_ProgressiveRenderer::ToBeContinued ==
17 FPDF_RENDER_TOBECOUNTINUED,
18 "CPDF_ProgressiveRenderer::ToBeContinued value mismatch");
19 static_assert(CPDF_ProgressiveRenderer::Done == FPDF_RENDER_DONE,
20 "CPDF_ProgressiveRenderer::Done value mismatch");
21 static_assert(CPDF_ProgressiveRenderer::Failed == FPDF_RENDER_FAILED,
22 "CPDF_ProgressiveRenderer::Failed value mismatch");
23
24 DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
25 FPDF_PAGE page,
26 int start_x,
27 int start_y,
28 int size_x,
29 int size_y,
30 int rotate,
31 int flags,
32 IFSDK_PAUSE* pause) {
33 if (!bitmap || !pause || pause->version != 1)
34 return FPDF_RENDER_FAILED;
35
36 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
37 if (!pPage)
38 return FPDF_RENDER_FAILED;
39
40 CRenderContext* pContext = new CRenderContext;
41 pPage->SetPrivateData((void*)1, pContext, DropContext);
42 #ifdef _SKIA_SUPPORT_
43 pContext->m_pDevice = new CFX_SkiaDevice;
44 if (flags & FPDF_REVERSE_BYTE_ORDER)
45 ((CFX_SkiaDevice*)pContext->m_pDevice)
46 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
47 else
48 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
49 #else
50 pContext->m_pDevice = new CFX_FxgeDevice;
51 if (flags & FPDF_REVERSE_BYTE_ORDER)
52 ((CFX_FxgeDevice*)pContext->m_pDevice)
53 ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
54 else
55 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
56 #endif
57 IFSDK_PAUSE_Adapter IPauseAdapter(pause);
58
59 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
60 rotate, flags, FALSE, &IPauseAdapter);
61
62 if (pContext->m_pRenderer) {
63 return CPDF_ProgressiveRenderer::ToFPDFStatus(
64 pContext->m_pRenderer->GetStatus());
65 }
66 return FPDF_RENDER_FAILED;
67 }
68
69 DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
70 IFSDK_PAUSE* pause) {
71 if (!pause || pause->version != 1)
72 return FPDF_RENDER_FAILED;
73
74 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
75 if (!pPage)
76 return FPDF_RENDER_FAILED;
77
78 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1);
79 if (pContext && pContext->m_pRenderer) {
80 IFSDK_PAUSE_Adapter IPauseAdapter(pause);
81 pContext->m_pRenderer->Continue(&IPauseAdapter);
82 return CPDF_ProgressiveRenderer::ToFPDFStatus(
83 pContext->m_pRenderer->GetStatus());
84 }
85 return FPDF_RENDER_FAILED;
86 }
87
88 DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) {
89 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
90 if (!pPage)
91 return;
92
93 CRenderContext* pContext = (CRenderContext*)pPage->GetPrivateData((void*)1);
94 if (!pContext)
95 return;
96
97 pContext->m_pDevice->RestoreState();
98 delete pContext;
99 pPage->RemovePrivateData((void*)1);
100 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_flatten.cpp ('k') | fpdfsdk/src/fpdf_searchex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698