OLD | NEW |
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 <poppler-document.h> | 14 #include <poppler-document.h> |
15 #include <poppler-image.h> | 15 #include <poppler-image.h> |
16 #include <poppler-page.h> | 16 #include <poppler-page.h> |
17 #include <poppler-page-renderer.h> | 17 #include <poppler-page-renderer.h> |
18 | 18 |
19 #include "SkPDFRasterizer.h" | 19 #include "SkPDFRasterizer.h" |
20 #include "SkColorPriv.h" | 20 #include "SkColorPriv.h" |
| 21 #include "SkPdfRenderer.h" |
21 | 22 |
22 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { | 23 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { |
23 size_t size = pdf->getLength(); | 24 size_t size = pdf->getLength(); |
24 SkAutoFree buffer(sk_malloc_throw(size)); | 25 SkAutoFree buffer(sk_malloc_throw(size)); |
25 pdf->read(buffer.get(), size); | 26 pdf->read(buffer.get(), size); |
26 | 27 |
27 SkAutoTDelete<poppler::document> doc( | 28 SkAutoTDelete<poppler::document> doc( |
28 poppler::document::load_from_raw_data((const char*)buffer.get(), size)); | 29 poppler::document::load_from_raw_data((const char*)buffer.get(), size)); |
29 if (!doc.get() || doc->is_locked()) { | 30 if (!doc.get() || doc->is_locked()) { |
30 return false; | 31 return false; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 bitmapPixels++; | 65 bitmapPixels++; |
65 rowData += 4; | 66 rowData += 4; |
66 } | 67 } |
67 imgData += rowSize; | 68 imgData += rowSize; |
68 } | 69 } |
69 | 70 |
70 output->swap(bitmap); | 71 output->swap(bitmap); |
71 | 72 |
72 return true; | 73 return true; |
73 } | 74 } |
| 75 |
| 76 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) { |
| 77 return SkPDFNativeRenderToBitmap(pdf, output); |
| 78 } |
OLD | NEW |