1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef MOZILLA_GFX_PRINTTARGETRECORDING_H
7 #define MOZILLA_GFX_PRINTTARGETRECORDING_H
8 
9 #include "PrintTarget.h"
10 
11 namespace mozilla {
12 namespace gfx {
13 
14 /**
15  * Recording printing target.
16  *
17  * This exists for use on e10s's content process in order to record print
18  * output, send it over to the parent process, and replay it on a DrawTarget
19  * there for printing.
20  */
21 class PrintTargetRecording final : public PrintTarget
22 {
23 public:
24   static already_AddRefed<PrintTargetRecording>
25   CreateOrNull(const IntSize& aSize);
26 
27   virtual already_AddRefed<DrawTarget>
28   MakeDrawTarget(const IntSize& aSize,
29                  DrawEventRecorder* aRecorder = nullptr) override;
30 
31 private:
32   PrintTargetRecording(cairo_surface_t* aCairoSurface,
33                        const IntSize& aSize);
34 
35   already_AddRefed<DrawTarget>
36   CreateRecordingDrawTarget(DrawEventRecorder* aRecorder,
37                             DrawTarget* aDrawTarget);
38 };
39 
40 } // namespace gfx
41 } // namespace mozilla
42 
43 #endif /* MOZILLA_GFX_PRINTTARGETRECORDING_H */
44