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

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

Issue 26269002: Initial draft code to run pdfviewer withg gms (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: use a variable instead of commenting the dsefine, so we can enable it on a buildbot Created 7 years, 1 month 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 <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
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 }
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