gecko-dev/gfx/thebes/PrintTargetSkPDF.h
Wes Kocher 24a327994e Backed out 9 changesets (bug 1340627) for graphical glitches a=backout
Backed out changeset 0b1371055c7f (bug 1340627)
Backed out changeset f152be1fadb7 (bug 1340627)
Backed out changeset c691e2ab6a0c (bug 1340627)
Backed out changeset 3cb4bceb8d79 (bug 1340627)
Backed out changeset 026aadd76d06 (bug 1340627)
Backed out changeset fdbd5d281287 (bug 1340627)
Backed out changeset 75fb0d9858a9 (bug 1340627)
Backed out changeset 0d4ec7d38a00 (bug 1340627)
Backed out changeset af6f19870b2a (bug 1340627)

MozReview-Commit-ID: 9dHr7xMZezY

--HG--
rename : gfx/skia/skia/src/core/SkBlitRow.h => gfx/skia/skia/include/core/SkBlitRow.h
rename : gfx/skia/skia/src/effects/SkGaussianEdgeShader.h => gfx/skia/skia/include/effects/SkGaussianEdgeShader.h
rename : gfx/skia/skia/src/xml/SkXMLParser.h => gfx/skia/skia/include/xml/SkXMLParser.h
rename : gfx/skia/skia/include/private/SkMessageBus.h => gfx/skia/skia/src/core/SkMessageBus.h
rename : gfx/skia/skia/src/gpu/ops/GrAAConvexPathRenderer.h => gfx/skia/skia/src/gpu/batches/GrAAConvexPathRenderer.h
rename : gfx/skia/skia/src/gpu/ops/GrAAConvexTessellator.h => gfx/skia/skia/src/gpu/batches/GrAAConvexTessellator.h
rename : gfx/skia/skia/src/gpu/ops/GrAAHairLinePathRenderer.h => gfx/skia/skia/src/gpu/batches/GrAAHairLinePathRenderer.h
rename : gfx/skia/skia/src/gpu/ops/GrAALinearizingConvexPathRenderer.h => gfx/skia/skia/src/gpu/batches/GrAALinearizingConvexPathRenderer.h
rename : gfx/skia/skia/src/gpu/ops/GrPathStencilSettings.h => gfx/skia/skia/src/gpu/batches/GrPathStencilSettings.h
rename : gfx/skia/skia/src/gpu/ops/GrStencilAndCoverPathRenderer.h => gfx/skia/skia/src/gpu/batches/GrStencilAndCoverPathRenderer.h
rename : gfx/skia/skia/include/private/GrGLSL_impl.h => gfx/skia/skia/src/gpu/glsl/GrGLSL_impl.h
2017-05-10 10:01:18 -07:00

77 lines
2.4 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_PRINTTARGETSKPDF_H
#define MOZILLA_GFX_PRINTTARGETSKPDF_H
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h"
#include "PrintTarget.h"
#include "SkCanvas.h"
#include "SkDocument.h"
#include "SkStream.h"
namespace mozilla {
namespace gfx {
/**
* Skia PDF printing target.
*/
class PrintTargetSkPDF final : public PrintTarget
{
public:
// The returned PrintTargetSkPDF keeps a raw pointer to the passed SkWStream
// but does not own it. Callers are responsible for ensuring that passed
// stream outlives the returned PrintTarget.
static already_AddRefed<PrintTargetSkPDF>
CreateOrNull(UniquePtr<SkWStream> aStream,
const IntSize& aSizeInPoints);
virtual nsresult BeginPrinting(const nsAString& aTitle,
const nsAString& aPrintToFileName,
int32_t aStartPage,
int32_t aEndPage) override;
virtual nsresult EndPrinting() override;
virtual void Finish() override;
virtual nsresult BeginPage() override;
virtual nsresult EndPage() override;
virtual already_AddRefed<DrawTarget>
MakeDrawTarget(const IntSize& aSize,
DrawEventRecorder* aRecorder = nullptr) final;
virtual already_AddRefed<DrawTarget>
GetReferenceDrawTarget(DrawEventRecorder* aRecorder) override final;
private:
PrintTargetSkPDF(const IntSize& aSize,
UniquePtr<SkWStream> aStream);
virtual ~PrintTargetSkPDF();
// Do not hand out references to this object. It holds a non-owning
// reference to mOStreame, so must not outlive mOStream.
sk_sp<SkDocument> mPDFDoc;
// The stream that the SkDocument outputs to.
UniquePtr<SkWStream> mOStream;
// The current page's SkCanvas and its wrapping DrawTarget:
// Canvas is owned by mPDFDoc, which handles its deletion.
SkCanvas* mPageCanvas;
RefPtr<DrawTarget> mPageDT;
// Members needed to provide a reference DrawTarget:
sk_sp<SkDocument> mRefPDFDoc;
// Canvas owned by mRefPDFDoc, which handles its deletion.
SkCanvas* mRefCanvas;
SkDynamicMemoryWStream mRefOStream;
};
} // namespace gfx
} // namespace mozilla
#endif /* MOZILLA_GFX_PRINTTARGETSKPDF_H */