| OLD | NEW |
| 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 #ifndef SkDocument_DEFINED | 8 #ifndef SkDocument_DEFINED |
| 9 #define SkDocument_DEFINED | 9 #define SkDocument_DEFINED |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // note: subclasses must call close() in their destructor, as the base class | 115 // note: subclasses must call close() in their destructor, as the base class |
| 116 // cannot do this for them. | 116 // cannot do this for them. |
| 117 virtual ~SkDocument(); | 117 virtual ~SkDocument(); |
| 118 | 118 |
| 119 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, | 119 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, |
| 120 const SkRect& content) = 0; | 120 const SkRect& content) = 0; |
| 121 virtual void onEndPage() = 0; | 121 virtual void onEndPage() = 0; |
| 122 virtual bool onClose(SkWStream*) = 0; | 122 virtual bool onClose(SkWStream*) = 0; |
| 123 virtual void onAbort() = 0; | 123 virtual void onAbort() = 0; |
| 124 | 124 |
| 125 // Allows subclasses to write to the stream as pages are written. |
| 126 SkWStream* getStream() { return fStream; } |
| 127 |
| 125 enum State { | 128 enum State { |
| 126 kBetweenPages_State, | 129 kBetweenPages_State, |
| 127 kInPage_State, | 130 kInPage_State, |
| 128 kClosed_State | 131 kClosed_State |
| 129 }; | 132 }; |
| 130 State getState() const { return fState; } | 133 State getState() const { return fState; } |
| 131 | 134 |
| 132 private: | 135 private: |
| 133 SkWStream* fStream; | 136 SkWStream* fStream; |
| 134 void (*fDoneProc)(SkWStream*, bool aborted); | 137 void (*fDoneProc)(SkWStream*, bool aborted); |
| 135 State fState; | 138 State fState; |
| 136 | 139 |
| 137 typedef SkRefCnt INHERITED; | 140 typedef SkRefCnt INHERITED; |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 #endif | 143 #endif |
| OLD | NEW |