aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xps/SkXPSDocument.h
blob: 726af8f58f64d3b8361f829cef9f06dbfae016a7 (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, const SkRect&) 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