Chromium Code Reviews| Index: include/core/SkDocument.h |
| diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h |
| index bbed64a80691fb3fde1358904ec02ba5b5bb8d3b..c6ab1d12a3ede8bd70e239a6d708c909132ae90f 100644 |
| --- a/include/core/SkDocument.h |
| +++ b/include/core/SkDocument.h |
| @@ -8,8 +8,11 @@ |
| #ifndef SkDocument_DEFINED |
| #define SkDocument_DEFINED |
| +#include "SkPDFCallbacks.h" |
| #include "SkRect.h" |
| #include "SkRefCnt.h" |
| +#include "SkBitmap.h" |
| +#include "SkRect.h" |
| class SkCanvas; |
| class SkWStream; |
| @@ -51,8 +54,8 @@ public: |
| * into the page. The document owns this canvas, and it will go out of |
| * scope when endPage() or close() is called, or the document is deleted. |
| */ |
| - SkCanvas* beginPage(SkScalar width, SkScalar height, |
| - const SkRect* content = NULL); |
| + SkCanvas* beginPage(const SkSize& trimSize, |
| + const SkRect* mediaBox = NULL); |
|
reed1
2013/09/26 17:00:46
// What is stored in the doc if I pass null? Does
edisonn
2013/09/26 19:44:09
added comment
|
| /** |
| * Call endPage() when the content for the current page has been drawn |
| @@ -67,7 +70,30 @@ public: |
| * can no longer add new pages. Deleting the document will automatically |
| * call close() if need be. |
| */ |
| - void close(); |
| + bool close(); |
|
reed1
2013/09/26 17:00:46
// What does returning true of false indicate?
edisonn
2013/09/26 19:44:09
added comment
|
| + |
| + /** |
| + * Call abort() to stop producing the document immediately. |
| + * The stream output must be ignored, and should not be trusted. |
| + */ |
| + void abort(); |
| + |
| + /** Sets the DCTEncoder for images. |
| + * @param encoder The encoder to encode a bitmap as JPEG (DCT). |
| + * Result of encodings are cached, if the encoder changes the |
| + * behaivor dynamically and an image is added to a second catalog, |
| + * we will likely use the result of the first encoding call. |
| + * By returning false from the encoder function, the encoder result |
| + * is not used. |
| + * Callers might not want to encode small images, as the time spent |
| + * encoding and decoding might not be worth the space savings, |
| + * if any at all. |
| + * Returns false if DCT encoder is not supported in the document. |
| + */ |
| + |
| + virtual bool setDCTEncoder(EncodeToDCTStream) { |
|
reed1
2013/09/26 17:00:46
1. Lets try very very hard to keep this header cle
edisonn
2013/09/26 19:44:09
Not yet implemented, working on it. For one, I als
|
| + return false; |
| + } |
| protected: |
| SkDocument(SkWStream*, void (*)(SkWStream*)); |
| @@ -75,10 +101,11 @@ protected: |
| // cannot do this for them. |
| virtual ~SkDocument(); |
| - virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, |
| - const SkRect& content) = 0; |
| + virtual SkCanvas* onBeginPage(const SkSize& trimSize, |
| + const SkRect* mediaBox) = 0; |
| virtual void onEndPage() = 0; |
| - virtual void onClose(SkWStream*) = 0; |
| + virtual bool onClose(SkWStream*) = 0; |
| + virtual void onAbort() = 0; |
| enum State { |
| kBetweenPages_State, |