SkDocument: remove unused fDoneProc

Change-Id: I9a0739992e90a0a6d44a75b0b570097553343f1d
Reviewed-on: https://skia-review.googlesource.com/92141
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
Hal Canary 2018-01-08 15:02:36 -05:00 committed by Skia Commit-Bot
parent 274218ef01
commit c5980d0aa3
7 changed files with 11 additions and 26 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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());
}

View File

@ -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;

View File

@ -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);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -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})
{