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

Side by Side Diff: include/core/SkDocument.h

Issue 2354403002: document.close from bool to void (Closed)
Patch Set: keep endPortfolio returning a bool Created 4 years, 3 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') | src/core/SkDocument.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 #ifndef SkDocument_DEFINED 8 #ifndef SkDocument_DEFINED
9 #define SkDocument_DEFINED 9 #define SkDocument_DEFINED
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 * (into the canvas returned by beginPage()). After this call the canvas 168 * (into the canvas returned by beginPage()). After this call the canvas
169 * returned by beginPage() will be out-of-scope. 169 * returned by beginPage() will be out-of-scope.
170 */ 170 */
171 void endPage(); 171 void endPage();
172 172
173 /** 173 /**
174 * Call close() when all pages have been drawn. This will close the file 174 * Call close() when all pages have been drawn. This will close the file
175 * or stream holding the document's contents. After close() the document 175 * or stream holding the document's contents. After close() the document
176 * can no longer add new pages. Deleting the document will automatically 176 * can no longer add new pages. Deleting the document will automatically
177 * call close() if need be. 177 * call close() if need be.
178 * Returns true on success or false on failure.
179 */ 178 */
180 bool close(); 179 void close();
181 180
182 /** 181 /**
183 * Call abort() to stop producing the document immediately. 182 * Call abort() to stop producing the document immediately.
184 * The stream output must be ignored, and should not be trusted. 183 * The stream output must be ignored, and should not be trusted.
185 */ 184 */
186 void abort(); 185 void abort();
187 186
188 protected: 187 protected:
189 SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted)); 188 SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted));
190 189
191 // note: subclasses must call close() in their destructor, as the base class 190 // note: subclasses must call close() in their destructor, as the base class
192 // cannot do this for them. 191 // cannot do this for them.
193 virtual ~SkDocument(); 192 virtual ~SkDocument();
194 193
195 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, 194 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height,
196 const SkRect& content) = 0; 195 const SkRect& content) = 0;
197 virtual void onEndPage() = 0; 196 virtual void onEndPage() = 0;
198 virtual bool onClose(SkWStream*) = 0; 197 virtual void onClose(SkWStream*) = 0;
199 virtual void onAbort() = 0; 198 virtual void onAbort() = 0;
200 199
201 // Allows subclasses to write to the stream as pages are written. 200 // Allows subclasses to write to the stream as pages are written.
202 SkWStream* getStream() { return fStream; } 201 SkWStream* getStream() { return fStream; }
203 202
204 enum State { 203 enum State {
205 kBetweenPages_State, 204 kBetweenPages_State,
206 kInPage_State, 205 kInPage_State,
207 kClosed_State 206 kClosed_State
208 }; 207 };
209 State getState() const { return fState; } 208 State getState() const { return fState; }
210 209
211 private: 210 private:
212 SkWStream* fStream; 211 SkWStream* fStream;
213 void (*fDoneProc)(SkWStream*, bool aborted); 212 void (*fDoneProc)(SkWStream*, bool aborted);
214 State fState; 213 State fState;
215 214
216 typedef SkRefCnt INHERITED; 215 typedef SkRefCnt INHERITED;
217 }; 216 };
218 217
219 #endif 218 #endif
OLDNEW
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/core/SkDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698