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

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

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. Created 5 years, 11 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
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.h » ('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
(...skipping 17 matching lines...) Expand all
28 * 28 *
29 * The SkPdfRenderer class is used to render a PDF into canvas. 29 * The SkPdfRenderer class is used to render a PDF into canvas.
30 * 30 *
31 */ 31 */
32 class SkPdfRenderer : SkNoncopyable { 32 class SkPdfRenderer : SkNoncopyable {
33 public: 33 public:
34 // Create a new renderer from a stream. 34 // Create a new renderer from a stream.
35 // TODO(edisonn): replace it with a SkSmartStream which would know to to eff iciently 35 // TODO(edisonn): replace it with a SkSmartStream which would know to to eff iciently
36 // deal with a HTTP stream. 36 // deal with a HTTP stream.
37 // FIXME: Untested. 37 // FIXME: Untested.
38 // Does not affect ownership of SkStream.
38 static SkPdfRenderer* CreateFromStream(SkStream*); 39 static SkPdfRenderer* CreateFromStream(SkStream*);
39 // Create a new renderer from a file. 40 // Create a new renderer from a file.
40 static SkPdfRenderer* CreateFromFile(const char* filename); 41 static SkPdfRenderer* CreateFromFile(const char* filename);
41 42
42 ~SkPdfRenderer(); 43 ~SkPdfRenderer();
43 44
44 // Render a specific page into the canvas, in a specific rectangle. 45 // Render a specific page into the canvas, in a specific rectangle.
45 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; 46 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const;
46 47
47 // Returns the number of pages in the loaded pdf. 48 // Returns the number of pages in the loaded pdf.
48 int pages() const; 49 int pages() const;
49 50
50 // Returns the MediaBox of a page. Can be used by client to crate a canvas. 51 // Returns the MediaBox of a page. Can be used by client to crate a canvas.
51 SkRect MediaBox(int page) const; 52 SkRect MediaBox(int page) const;
52 53
53 // TODO(edisonn): for testing only, probably it should be removed, unless so me client wants to 54 // TODO(edisonn): for testing only, probably it should be removed, unless so me client wants to
54 // let users know how much memory the PDF needs. 55 // let users know how much memory the PDF needs.
55 size_t bytesUsed() const; 56 size_t bytesUsed() const;
56 57
57 private: 58 private:
58 // Takes ownership of SkPdfNativeDoc. 59 // Takes ownership of SkPdfNativeDoc.
59 SkPdfRenderer(SkPdfNativeDoc*); 60 SkPdfRenderer(SkPdfNativeDoc*);
60 SkPdfNativeDoc* fPdfDoc; 61 SkPdfNativeDoc* fPdfDoc;
61 }; 62 };
62 63
63 // For testing only, reports stats about rendering, like how many operations fai led, or are NYI, ... 64 // For testing only, reports stats about rendering, like how many operations fai led, or are NYI, ...
64 void reportPdfRenderStats(); 65 void reportPdfRenderStats();
65 66
66 // Renders a page of a pdf in a bitmap. 67 // Renders a page of a pdf in a bitmap.
68 // Does not affect ownership of stream.
67 bool SkPDFNativeRenderToBitmap(SkStream* stream, 69 bool SkPDFNativeRenderToBitmap(SkStream* stream,
68 SkBitmap* output, 70 SkBitmap* output,
69 int page = 0, 71 int page = 0,
70 SkPdfContent content = kAll_SkPdfContent, 72 SkPdfContent content = kAll_SkPdfContent,
71 double dpi = 72.0); 73 double dpi = 72.0);
72 74
73 // TODO(edisonn): add options to render forms, checkboxes, ... 75 // TODO(edisonn): add options to render forms, checkboxes, ...
74 // TODO(edisonn): Add API for Forms viewing and editing 76 // TODO(edisonn): Add API for Forms viewing and editing
75 // e.g. SkBitmap getPage(int page); 77 // e.g. SkBitmap getPage(int page);
76 // int formsCount(); 78 // int formsCount();
77 // SkForm getForm(int formID); // SkForm(SkRect, .. other data) 79 // SkForm getForm(int formID); // SkForm(SkRect, .. other data)
78 // TODO (edisonn): Add intend when loading pdf, for example: for viewing, for pa rsing content, ... 80 // TODO (edisonn): Add intend when loading pdf, for example: for viewing, for pa rsing content, ...
79 81
80 #endif // SkPdfRenderer_DEFINED 82 #endif // SkPdfRenderer_DEFINED
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698