OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PRINTING_METAFILE_SKIA_WRAPPER_H_ | 5 #ifndef PRINTING_METAFILE_SKIA_WRAPPER_H_ |
6 #define PRINTING_METAFILE_SKIA_WRAPPER_H_ | 6 #define PRINTING_METAFILE_SKIA_WRAPPER_H_ |
7 | 7 |
| 8 #include "cc/paint/paint_canvas.h" |
8 #include "printing/printing_export.h" | 9 #include "printing/printing_export.h" |
9 #include "third_party/skia/include/core/SkRefCnt.h" | 10 #include "third_party/skia/include/core/SkRefCnt.h" |
10 | 11 |
11 class SkCanvas; | |
12 | |
13 namespace printing { | 12 namespace printing { |
14 | 13 |
15 class PdfMetafileSkia; | 14 class PdfMetafileSkia; |
16 | 15 |
17 // A wrapper class with static methods to set and retrieve a PdfMetafileSkia | 16 // A wrapper class with static methods to set and retrieve a PdfMetafileSkia |
18 // on an SkCanvas. The ownership of the metafile is not affected and it | 17 // on an SkCanvas. The ownership of the metafile is not affected and it |
19 // is the caller's responsibility to ensure that the metafile remains valid | 18 // is the caller's responsibility to ensure that the metafile remains valid |
20 // as long as the canvas. | 19 // as long as the canvas. |
21 class PRINTING_EXPORT MetafileSkiaWrapper : public SkRefCnt { | 20 class PRINTING_EXPORT MetafileSkiaWrapper : public SkRefCnt { |
22 public: | 21 public: |
23 static void SetMetafileOnCanvas(const SkCanvas& canvas, | 22 static void SetMetafileOnCanvas(cc::PaintCanvas* canvas, |
24 PdfMetafileSkia* metafile); | 23 PdfMetafileSkia* metafile); |
25 | 24 |
26 static PdfMetafileSkia* GetMetafileFromCanvas(const SkCanvas& canvas); | 25 static PdfMetafileSkia* GetMetafileFromCanvas(cc::PaintCanvas* canvas); |
27 | 26 |
28 private: | 27 private: |
29 explicit MetafileSkiaWrapper(PdfMetafileSkia* metafile); | 28 explicit MetafileSkiaWrapper(PdfMetafileSkia* metafile); |
30 | 29 |
31 PdfMetafileSkia* metafile_; | 30 PdfMetafileSkia* metafile_; |
32 }; | 31 }; |
33 | 32 |
34 } // namespace printing | 33 } // namespace printing |
35 | 34 |
36 #endif // PRINTING_METAFILE_SKIA_WRAPPER_H_ | 35 #endif // PRINTING_METAFILE_SKIA_WRAPPER_H_ |
OLD | NEW |