blob: 8bbc4f1eb29134fad9a85e73a216928abf5233bf [file] [log] [blame]
edisonn@google.com222382b2013-07-10 22:33:10 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
edisonn@google.com15b11182013-07-11 14:43:15 +00009#ifndef SkPdfRenderer_DEFINED
10#define SkPdfRenderer_DEFINED
edisonn@google.com222382b2013-07-10 22:33:10 +000011
12class SkCanvas;
13class SkNativeParsedPDF;
edisonn@google.com444e25a2013-07-11 15:20:50 +000014class SkRect;
edisonn@google.com222382b2013-07-10 22:33:10 +000015
16// TODO(edisonn): move in another file
17class SkPdfRenderer : public SkRefCnt {
18 SkNativeParsedPDF* fPdfDoc;
19public:
20 SkPdfRenderer() : fPdfDoc(NULL) {}
21 virtual ~SkPdfRenderer() {unload();}
22
23 // TODO(edisonn): add options to render forms, or not
edisonn@google.com444e25a2013-07-11 15:20:50 +000024 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const;
edisonn@google.com222382b2013-07-10 22:33:10 +000025
26 bool load(const SkString inputFileName);
27 bool loaded() const {return fPdfDoc != NULL;}
28 int pages() const;
29 void unload();
30 SkRect MediaBox(int page) const;
edisonn@google.com7b328fd2013-07-11 12:53:06 +000031 size_t bytesUsed() const;
edisonn@google.com222382b2013-07-10 22:33:10 +000032};
33
34void reportPdfRenderStats();
35
edisonn@google.com15b11182013-07-11 14:43:15 +000036#endif // SkPdfRenderer_DEFINED