aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/PDFBench.cpp2
-rw-r--r--include/core/SkDocument.h3
-rw-r--r--src/core/SkDocument.cpp12
-rw-r--r--src/pdf/SkPDFDocument.cpp10
-rw-r--r--src/pdf/SkPDFDocument.h2
-rw-r--r--src/utils/SkMultiPictureDocument.cpp6
-rw-r--r--src/xps/SkXPSDocument.cpp2
7 files changed, 11 insertions, 26 deletions
diff --git a/bench/PDFBench.cpp b/bench/PDFBench.cpp
index 599539026f..bebf2b9f17 100644
--- a/bench/PDFBench.cpp
+++ b/bench/PDFBench.cpp
@@ -216,7 +216,7 @@ struct PDFShaderBench : public Benchmark {
SkASSERT(fShader);
while (loops-- > 0) {
SkNullWStream nullStream;
- SkPDFDocument doc(&nullStream, nullptr, SkDocument::PDFMetadata());
+ SkPDFDocument doc(&nullStream, SkDocument::PDFMetadata());
sk_sp<SkPDFObject> shader = SkPDFMakeShader(&doc, fShader.get(), SkMatrix::I(),
{0, 0, 400, 400}, SK_ColorBLACK);
}
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index 82b8a4ff25..7f293f149d 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -184,7 +184,7 @@ public:
void abort();
protected:
- SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted));
+ SkDocument(SkWStream*);
// note: subclasses must call close() in their destructor, as the base class
// cannot do this for them.
@@ -207,7 +207,6 @@ protected:
private:
SkWStream* fStream;
- void (*fDoneProc)(SkWStream*, bool aborted);
State fState;
typedef SkRefCnt INHERITED;
diff --git a/src/core/SkDocument.cpp b/src/core/SkDocument.cpp
index b7e242a9ab..cd5aa5a5fa 100644
--- a/src/core/SkDocument.cpp
+++ b/src/core/SkDocument.cpp
@@ -9,10 +9,7 @@
#include "SkDocument.h"
#include "SkStream.h"
-SkDocument::SkDocument(SkWStream* stream, void (*doneProc)(SkWStream*, bool))
- : fStream(stream) // we do not own this object.
- , fDoneProc(doneProc)
- , fState(kBetweenPages_State) {}
+SkDocument::SkDocument(SkWStream* stream) : fStream(stream), fState(kBetweenPages_State) {}
SkDocument::~SkDocument() {
this->close();
@@ -57,10 +54,6 @@ void SkDocument::close() {
case kBetweenPages_State: {
fState = kClosed_State;
this->onClose(fStream);
-
- if (fDoneProc) {
- fDoneProc(fStream, false);
- }
// we don't own the stream, but we mark it nullptr since we can
// no longer write to it.
fStream = nullptr;
@@ -79,9 +72,6 @@ void SkDocument::abort() {
this->onAbort();
fState = kClosed_State;
- if (fDoneProc) {
- fDoneProc(fStream, true);
- }
// we don't own the stream, but we mark it nullptr since we can
// no longer write to it.
fStream = nullptr;
diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp
index 939e9ed991..da7170ffbc 100644
--- a/src/pdf/SkPDFDocument.cpp
+++ b/src/pdf/SkPDFDocument.cpp
@@ -172,9 +172,8 @@ static sk_sp<SkPDFDict> generate_page_tree(SkTArray<sk_sp<SkPDFDict>>* pages) {
////////////////////////////////////////////////////////////////////////////////
SkPDFDocument::SkPDFDocument(SkWStream* stream,
- void (*doneProc)(SkWStream*, bool),
const SkDocument::PDFMetadata& metadata)
- : SkDocument(stream, doneProc)
+ : SkDocument(stream)
, fMetadata(metadata) {
}
@@ -425,7 +424,6 @@ void SkPDFDocument::onClose(SkWStream* stream) {
///////////////////////////////////////////////////////////////////////////////
sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
- void (*proc)(SkWStream*, bool),
const SkDocument::PDFMetadata& metadata) {
SkDocument::PDFMetadata meta = metadata;
if (meta.fRasterDPI <= 0) {
@@ -434,14 +432,14 @@ sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
if (meta.fEncodingQuality < 0) {
meta.fEncodingQuality = 0;
}
- return stream ? sk_make_sp<SkPDFDocument>(stream, proc, meta) : nullptr;
+ return stream ? sk_make_sp<SkPDFDocument>(stream, meta) : nullptr;
}
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, const PDFMetadata& metadata) {
- return SkPDFMakeDocument(stream, nullptr, metadata);
+ return SkPDFMakeDocument(stream, metadata);
}
sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream) {
- return SkPDFMakeDocument(stream, nullptr, PDFMetadata());
+ return SkPDFMakeDocument(stream, PDFMetadata());
}
diff --git a/src/pdf/SkPDFDocument.h b/src/pdf/SkPDFDocument.h
index a13670a080..ed92554bdf 100644
--- a/src/pdf/SkPDFDocument.h
+++ b/src/pdf/SkPDFDocument.h
@@ -25,7 +25,6 @@ class SkPDFDevice;
* SK_ScalarDefaultRasterDPI(72.0f).
*/
sk_sp<SkDocument> SkPDFMakeDocument(SkWStream* stream,
- void (*doneProc)(SkWStream*, bool),
const SkDocument::PDFMetadata&);
// Logically part of SkPDFDocument (like SkPDFCanon), but separate to
@@ -52,7 +51,6 @@ struct SkPDFObjectSerializer : SkNoncopyable {
class SkPDFDocument : public SkDocument {
public:
SkPDFDocument(SkWStream*,
- void (*)(SkWStream*, bool),
const SkDocument::PDFMetadata&);
~SkPDFDocument() override;
SkCanvas* onBeginPage(SkScalar, SkScalar) override;
diff --git a/src/utils/SkMultiPictureDocument.cpp b/src/utils/SkMultiPictureDocument.cpp
index b3e84dc74e..b09db06f11 100644
--- a/src/utils/SkMultiPictureDocument.cpp
+++ b/src/utils/SkMultiPictureDocument.cpp
@@ -51,8 +51,8 @@ struct MultiPictureDocument final : public SkDocument {
SkSize fCurrentPageSize;
SkTArray<sk_sp<SkPicture>> fPages;
SkTArray<SkSize> fSizes;
- MultiPictureDocument(SkWStream* s, void (*d)(SkWStream*, bool), const SkSerialProcs* procs)
- : SkDocument(s, d)
+ MultiPictureDocument(SkWStream* s, const SkSerialProcs* procs)
+ : SkDocument(s)
, fProcs(procs ? *procs : SkSerialProcs())
{}
~MultiPictureDocument() override { this->close(); }
@@ -94,7 +94,7 @@ struct MultiPictureDocument final : public SkDocument {
}
sk_sp<SkDocument> SkMakeMultiPictureDocument(SkWStream* wStream, const SkSerialProcs* procs) {
- return sk_make_sp<MultiPictureDocument>(wStream, nullptr, procs);
+ return sk_make_sp<MultiPictureDocument>(wStream, procs);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/xps/SkXPSDocument.cpp b/src/xps/SkXPSDocument.cpp
index ac62c62002..05bb280a1f 100644
--- a/src/xps/SkXPSDocument.cpp
+++ b/src/xps/SkXPSDocument.cpp
@@ -16,7 +16,7 @@
SkXPSDocument::SkXPSDocument(SkWStream* stream,
SkScalar dpi,
SkTScopedComPtr<IXpsOMObjectFactory> xpsFactory)
- : SkDocument(stream, nullptr)
+ : SkDocument(stream)
, fXpsFactory(std::move(xpsFactory))
, fDevice(SkISize{10000, 10000})
{