• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkXPSDocument_DEFINED
9 #define SkXPSDocument_DEFINED
10 
11 #include "SkTypes.h"
12 
13 #ifdef SK_BUILD_FOR_WIN
14 
15 #include "SkDocument.h"
16 #include "SkXPSDevice.h"
17 #include "SkTScopedComPtr.h"
18 
19 #include <XpsObjectModel.h>
20 
21 class SkXPSDocument final : public SkDocument {
22 public:
23     SkXPSDocument(SkWStream*, SkScalar dpi, SkTScopedComPtr<IXpsOMObjectFactory>);
24     virtual ~SkXPSDocument();
25 
26 protected:
27     SkCanvas* onBeginPage(SkScalar w, SkScalar h) override;
28     void onEndPage() override;
29     void onClose(SkWStream*) override;
30     void onAbort() override;
31 
32 private:
33     SkTScopedComPtr<IXpsOMObjectFactory> fXpsFactory;
34     SkXPSDevice fDevice;
35     std::unique_ptr<SkCanvas> fCanvas;
36     SkVector fUnitsPerMeter;
37     SkVector fPixelsPerMeter;
38 };
39 
40 #endif  // SK_BUILD_FOR_WIN
41 #endif  // SkXPSDocument_DEFINED
42