Hal Canary | abc88d2 | 2017-02-06 09:26:49 -0500 | [diff] [blame] | 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: |
Hal Canary | 5e221e7 | 2017-02-06 09:51:42 -0500 | [diff] [blame] | 23 | SkXPSDocument(SkWStream*, SkScalar dpi, SkTScopedComPtr<IXpsOMObjectFactory>); |
Hal Canary | abc88d2 | 2017-02-06 09:26:49 -0500 | [diff] [blame] | 24 | virtual ~SkXPSDocument(); |
| 25 | |
| 26 | protected: |
Hal Canary | b1de5f9 | 2017-07-01 22:17:15 -0400 | [diff] [blame] | 27 | SkCanvas* onBeginPage(SkScalar w, SkScalar h) override; |
Hal Canary | abc88d2 | 2017-02-06 09:26:49 -0500 | [diff] [blame] | 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 |