Index: src/doc/SkDocument.cpp |
diff --git a/src/doc/SkDocument.cpp b/src/doc/SkDocument.cpp |
index 055c749792bb29c4de263c8e55f96d80b4ee08ab..0989c141b8532b58250aefd3bc1fc966455ff501 100644 |
--- a/src/doc/SkDocument.cpp |
+++ b/src/doc/SkDocument.cpp |
@@ -22,20 +22,20 @@ SkDocument::~SkDocument() { |
SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height, |
const SkRect* content) { |
- if (width <= 0 || height <= 0) { |
- return NULL; |
- } |
+ if (width <= 0 || height <= 0) { |
vandebo (ex-Chrome)
2013/10/08 23:37:06
nit: extra spaces
|
+ return NULL; |
+ } |
- SkRect outer = SkRect::MakeWH(width, height); |
- SkRect inner; |
- if (content) { |
- inner = *content; |
- if (!inner.intersect(outer)) { |
- return NULL; |
- } |
- } else { |
- inner = outer; |
- } |
+ SkRect outer = SkRect::MakeWH(width, height); |
+ SkRect inner; |
+ if (content) { |
+ inner = *content; |
+ if (!inner.intersect(outer)) { |
+ return NULL; |
+ } |
+ } else { |
+ inner = outer; |
+ } |
for (;;) { |
switch (fState) { |
@@ -60,12 +60,12 @@ void SkDocument::endPage() { |
} |
} |
-void SkDocument::close() { |
+bool SkDocument::close() { |
for (;;) { |
switch (fState) { |
- case kBetweenPages_State: |
+ case kBetweenPages_State: { |
fState = kClosed_State; |
- this->onClose(fStream); |
+ bool success = this->onClose(fStream); |
if (fDoneProc) { |
fDoneProc(fStream); |
@@ -73,12 +73,17 @@ void SkDocument::close() { |
// we don't own the stream, but we mark it NULL since we can |
// no longer write to it. |
fStream = NULL; |
- return; |
+ return success; |
+ } |
case kInPage_State: |
this->endPage(); |
break; |
case kClosed_State: |
- return; |
+ return false; |
} |
} |
} |
+ |
+void SkDocument::abort() { |
+ fState = kClosed_State; |
+} |