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

Side by Side Diff: experimental/PdfViewer/SkPdfRenderer.h

Issue 20087003: pdfviewer: remove dependency on picture_utils. add utility function to render SkStream into bitmap. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « no previous file | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef SkPdfRenderer_DEFINED 9 #ifndef SkPdfRenderer_DEFINED
10 #define SkPdfRenderer_DEFINED 10 #define SkPdfRenderer_DEFINED
11 11
12 class SkBitmap;
12 class SkCanvas; 13 class SkCanvas;
13 class SkNativeParsedPDF; 14 class SkNativeParsedPDF;
14 class SkRect; 15 class SkRect;
16 class SkStream;
17
18 enum SkPdfContent {
19 kNoForms_SkPdfContent,
20 kAll_SkPdfContent,
21 };
15 22
16 // TODO(edisonn): move in another file 23 // TODO(edisonn): move in another file
17 class SkPdfRenderer : public SkRefCnt { 24 class SkPdfRenderer : public SkRefCnt {
18 SkNativeParsedPDF* fPdfDoc; 25 SkNativeParsedPDF* fPdfDoc;
19 public: 26 public:
20 SkPdfRenderer() : fPdfDoc(NULL) {} 27 SkPdfRenderer() : fPdfDoc(NULL) {}
21 virtual ~SkPdfRenderer() {unload();} 28 virtual ~SkPdfRenderer() {unload();}
22 29
23 // TODO(edisonn): add options to render forms, or not 30 // TODO(edisonn): add options to render forms, or not
24 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; 31 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const;
25 32
26 bool load(const SkString inputFileName); 33 bool load(const SkString inputFileName);
34 bool load(SkStream* stream);
27 bool loaded() const {return fPdfDoc != NULL;} 35 bool loaded() const {return fPdfDoc != NULL;}
28 int pages() const; 36 int pages() const;
29 void unload(); 37 void unload();
30 SkRect MediaBox(int page) const; 38 SkRect MediaBox(int page) const;
31 size_t bytesUsed() const; 39 size_t bytesUsed() const;
32 }; 40 };
33 41
34 void reportPdfRenderStats(); 42 void reportPdfRenderStats();
35 43
44 bool SkPDFNativeRenderToBitmap(SkStream* stream,
45 SkBitmap* output,
46 int page = 0,
47 SkPdfContent content = kAll_SkPdfContent,
48 double dpi = 72.0);
49
36 #endif // SkPdfRenderer_DEFINED 50 #endif // SkPdfRenderer_DEFINED
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698