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

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

Issue 26912005: mode code cleanup (100c / l, comments) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 | « experimental/PdfViewer/SkPdfGraphicsState.cpp ('k') | 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 // TODO(edisonn): how to remove this dependency? Should I remove the ref countin g? 12 // TODO(edisonn): remove this dependency, and load only from a stream!
13 #include "SkRefCnt.h"
14 // TODO(edisonn): remove this dependency
15 #include "SkString.h" 13 #include "SkString.h"
16 14
17 class SkBitmap; 15 class SkBitmap;
18 class SkCanvas; 16 class SkCanvas;
19 class SkPdfNativeDoc; 17 class SkPdfNativeDoc;
20 struct SkRect; 18 struct SkRect;
21 class SkStream; 19 class SkStream;
22 class SkString; 20 class SkString;
23 21
24 enum SkPdfContent { 22 enum SkPdfContent {
25 kNoForms_SkPdfContent, 23 kNoForms_SkPdfContent,
26 kAll_SkPdfContent, 24 kAll_SkPdfContent,
27 }; 25 };
28 26
29 // TODO(edisonn): move in another file 27 // TODO(edisonn): add options to render forms, checkboxes, ...
30 class SkPdfRenderer : public SkRefCnt { 28 // TODO(edisonn): Add API for Forms viewing and editing
29 // e.g. SkBitmap getPage(int page);
30 // int formsCount();
31 // SkForm getForm(int formID); // SkForm(SkRect, .. other data)
32 // TODO (edisonn): Add intend when loading pdf, for example: for viewing, for pa rsing content, ...
33
34 class SkPdfRenderer {
31 SkPdfNativeDoc* fPdfDoc; 35 SkPdfNativeDoc* fPdfDoc;
32 public: 36 public:
33 SkPdfRenderer() : fPdfDoc(NULL) {} 37 SkPdfRenderer() : fPdfDoc(NULL) {}
34 virtual ~SkPdfRenderer() {unload();} 38 virtual ~SkPdfRenderer() {unload();}
35 39
36 // TODO(edisonn): add options to render forms, or not
37 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; 40 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const;
38 41
42 // TODO(edisonn): deprecated, should be removed!
39 bool load(const SkString inputFileName); 43 bool load(const SkString inputFileName);
44
40 bool load(SkStream* stream); 45 bool load(SkStream* stream);
46
47 void unload();
48
41 bool loaded() const {return fPdfDoc != NULL;} 49 bool loaded() const {return fPdfDoc != NULL;}
50
42 int pages() const; 51 int pages() const;
43 void unload(); 52
44 SkRect MediaBox(int page) const; 53 SkRect MediaBox(int page) const;
54
55 // TODO(edisonn): for testing only, probably it should be removed, unless so me client wants to
56 // let users know how much memory the PDF needs.
45 size_t bytesUsed() const; 57 size_t bytesUsed() const;
46 }; 58 };
47 59
48 void reportPdfRenderStats(); 60 void reportPdfRenderStats();
49 61
50 bool SkPDFNativeRenderToBitmap(SkStream* stream, 62 bool SkPDFNativeRenderToBitmap(SkStream* stream,
51 SkBitmap* output, 63 SkBitmap* output,
52 int page = 0, 64 int page = 0,
53 SkPdfContent content = kAll_SkPdfContent, 65 SkPdfContent content = kAll_SkPdfContent,
54 double dpi = 72.0); 66 double dpi = 72.0);
55 67
56 #endif // SkPdfRenderer_DEFINED 68 #endif // SkPdfRenderer_DEFINED
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfGraphicsState.cpp ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698