| 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 #ifdef SK_BUILD_NATIVE_PDF_RENDERER |
| 21 #include "SkPdfRenderer.h" | 22 #include "SkPdfRenderer.h" |
| 23 #endif // SK_BUILD_NATIVE_PDF_RENDERER |
| 22 | 24 |
| 23 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { | 25 bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) { |
| 24 size_t size = pdf->getLength(); | 26 size_t size = pdf->getLength(); |
| 25 SkAutoFree buffer(sk_malloc_throw(size)); | 27 SkAutoFree buffer(sk_malloc_throw(size)); |
| 26 pdf->read(buffer.get(), size); | 28 pdf->read(buffer.get(), size); |
| 27 | 29 |
| 28 SkAutoTDelete<poppler::document> doc( | 30 SkAutoTDelete<poppler::document> doc( |
| 29 poppler::document::load_from_raw_data((const char*)buffer.get(), size)); | 31 poppler::document::load_from_raw_data((const char*)buffer.get(), size)); |
| 30 if (!doc.get() || doc->is_locked()) { | 32 if (!doc.get() || doc->is_locked()) { |
| 31 return false; | 33 return false; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 rowData += 4; | 68 rowData += 4; |
| 67 } | 69 } |
| 68 imgData += rowSize; | 70 imgData += rowSize; |
| 69 } | 71 } |
| 70 | 72 |
| 71 output->swap(bitmap); | 73 output->swap(bitmap); |
| 72 | 74 |
| 73 return true; | 75 return true; |
| 74 } | 76 } |
| 75 | 77 |
| 78 #ifdef SK_BUILD_NATIVE_PDF_RENDERER |
| 76 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) { | 79 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) { |
| 77 return SkPDFNativeRenderToBitmap(pdf, output); | 80 return SkPDFNativeRenderToBitmap(pdf, output); |
| 78 } | 81 } |
| 82 #endif // SK_BUILD_NATIVE_PDF_RENDERER |
| OLD | NEW |