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

Side by Side Diff: src/xps/SkDocument_XPS.cpp

Issue 2354403002: document.close from bool to void (Closed)
Patch Set: keep endPortfolio returning a bool Created 4 years, 2 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 | « src/utils/SkMultiPictureDocument.cpp ('k') | tests/AnnotationTest.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 2015 Google Inc. 2 * Copyright 2015 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 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return fCanvas.get(); 42 return fCanvas.get();
43 } 43 }
44 44
45 void onEndPage() override { 45 void onEndPage() override {
46 SkASSERT(fCanvas.get()); 46 SkASSERT(fCanvas.get());
47 fCanvas->flush(); 47 fCanvas->flush();
48 fCanvas.reset(nullptr); 48 fCanvas.reset(nullptr);
49 fDevice.endSheet(); 49 fDevice.endSheet();
50 } 50 }
51 51
52 bool onClose(SkWStream*) override { 52 void onClose(SkWStream*) override {
53 SkASSERT(!fCanvas.get()); 53 SkASSERT(!fCanvas.get());
54 return fDevice.endPortfolio(); 54 (void)fDevice.endPortfolio();
55 } 55 }
56 56
57 void onAbort() override {} 57 void onAbort() override {}
58 58
59 private: 59 private:
60 SkXPSDevice fDevice; 60 SkXPSDevice fDevice;
61 SkAutoTUnref<SkCanvas> fCanvas; 61 SkAutoTUnref<SkCanvas> fCanvas;
62 SkVector fUnitsPerMeter; 62 SkVector fUnitsPerMeter;
63 SkVector fPixelsPerMeter; 63 SkVector fPixelsPerMeter;
64 }; 64 };
65 65
66 /////////////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////////////
67 67
68 sk_sp<SkDocument> SkDocument::MakeXPS(SkWStream* stream, SkScalar dpi) { 68 sk_sp<SkDocument> SkDocument::MakeXPS(SkWStream* stream, SkScalar dpi) {
69 return stream ? sk_make_sp<SkDocument_XPS>(stream, nullptr, dpi) : nullptr; 69 return stream ? sk_make_sp<SkDocument_XPS>(stream, nullptr, dpi) : nullptr;
70 } 70 }
71 71
72 static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; } 72 static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
73 73
74 sk_sp<SkDocument> SkDocument::MakeXPS(const char path[], SkScalar dpi) { 74 sk_sp<SkDocument> SkDocument::MakeXPS(const char path[], SkScalar dpi) {
75 SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path)); 75 SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
76 if (!stream->isValid()) { 76 if (!stream->isValid()) {
77 return nullptr; 77 return nullptr;
78 } 78 }
79 return sk_make_sp<SkDocument_XPS>(stream.release(), delete_wstream, dpi); 79 return sk_make_sp<SkDocument_XPS>(stream.release(), delete_wstream, dpi);
80 } 80 }
81 81
82 #endif//defined(SK_BUILD_FOR_WIN32) 82 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/utils/SkMultiPictureDocument.cpp ('k') | tests/AnnotationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698