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

Side by Side Diff: src/utils/SkPDFRasterizer.cpp

Issue 133583004: If poppler is disable and native pdf is enabled, we still need SkPDFRasterizer.cpp (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/utils/SkPDFRasterizer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifdef SK_BUILD_FOR_WIN32 9 #ifdef SK_BUILD_FOR_WIN32
10 #pragma warning(push) 10 #pragma warning(push)
11 #pragma warning(disable : 4530) 11 #pragma warning(disable : 4530)
12 #endif 12 #endif
13 13
14 #include "SkPDFRasterizer.h"
15 #include "SkColorPriv.h"
16
17 #ifdef SK_BUILD_NATIVE_PDF_RENDERER
18 #include "SkPdfRenderer.h"
19 #endif // SK_BUILD_NATIVE_PDF_RENDERER
20
21 #ifdef SK_BUILD_POPPLER
14 #include <poppler-document.h> 22 #include <poppler-document.h>
15 #include <poppler-image.h> 23 #include <poppler-image.h>
16 #include <poppler-page.h> 24 #include <poppler-page.h>
17 #include <poppler-page-renderer.h> 25 #include <poppler-page-renderer.h>
26 #endif // SK_BUILD_POPPLER
18 27
19 #include "SkPDFRasterizer.h" 28 #ifdef SK_BUILD_POPPLER
20 #include "SkColorPriv.h"
21 #ifdef SK_BUILD_NATIVE_PDF_RENDERER
22 #include "SkPdfRenderer.h"
23 #endif // SK_BUILD_NATIVE_PDF_RENDERER
24
25 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { 29 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) {
26 size_t size = pdf->getLength(); 30 size_t size = pdf->getLength();
27 SkAutoFree buffer(sk_malloc_throw(size)); 31 SkAutoFree buffer(sk_malloc_throw(size));
28 pdf->read(buffer.get(), size); 32 pdf->read(buffer.get(), size);
29 33
30 SkAutoTDelete<poppler::document> doc( 34 SkAutoTDelete<poppler::document> doc(
31 poppler::document::load_from_raw_data((const char*)buffer.get(), size)); 35 poppler::document::load_from_raw_data((const char*)buffer.get(), size));
32 if (!doc.get() || doc->is_locked()) { 36 if (!doc.get() || doc->is_locked()) {
33 return false; 37 return false;
34 } 38 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 bitmapPixels++; 71 bitmapPixels++;
68 rowData += 4; 72 rowData += 4;
69 } 73 }
70 imgData += rowSize; 74 imgData += rowSize;
71 } 75 }
72 76
73 output->swap(bitmap); 77 output->swap(bitmap);
74 78
75 return true; 79 return true;
76 } 80 }
81 #endif // SK_BUILD_POPPLER
77 82
78 #ifdef SK_BUILD_NATIVE_PDF_RENDERER 83 #ifdef SK_BUILD_NATIVE_PDF_RENDERER
79 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) { 84 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) {
80 return SkPDFNativeRenderToBitmap(pdf, output); 85 return SkPDFNativeRenderToBitmap(pdf, output);
81 } 86 }
82 #endif // SK_BUILD_NATIVE_PDF_RENDERER 87 #endif // SK_BUILD_NATIVE_PDF_RENDERER
OLDNEW
« no previous file with comments | « src/utils/SkPDFRasterizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698