aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xps/SkXPSDocument.h
blob: cccfc1f77763aeccaa71bf44288fe8e5dd6e397d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkXPSDocument_DEFINED
#define SkXPSDocument_DEFINED

#include "SkTypes.h"

#ifdef SK_BUILD_FOR_WIN

#include "SkDocument.h"
#include "SkXPSDevice.h"
#include "SkTScopedComPtr.h"

#include <XpsObjectModel.h>

class SkXPSDocument final : public SkDocument {
public:
    SkXPSDocument(SkWStream*, SkScalar dpi, SkTScopedComPtr<IXpsOMObjectFactory>);
    virtual ~SkXPSDocument();

protected:
    SkCanvas* onBeginPage(SkScalar w, SkScalar h) override;
    void onEndPage() override;
    void onClose(SkWStream*) override;
    void onAbort() override;

private:
    SkTScopedComPtr<IXpsOMObjectFactory> fXpsFactory;
    SkXPSDevice fDevice;
    std::unique_ptr<SkCanvas> fCanvas;
    SkVector fUnitsPerMeter;
    SkVector fPixelsPerMeter;
};

#endif  // SK_BUILD_FOR_WIN
#endif  // SkXPSDocument_DEFINED