[email protected] | f64d7a35 | 2012-05-09 17:22:21 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef PRINTING_METAFILE_SKIA_WRAPPER_H_ | ||||
6 | #define PRINTING_METAFILE_SKIA_WRAPPER_H_ | ||||
7 | |||||
enne | 7b64edf3 | 2017-02-16 20:10:02 | [diff] [blame] | 8 | #include "cc/paint/paint_canvas.h" |
[email protected] | 69f5b1e6 | 2011-09-01 06:34:04 | [diff] [blame] | 9 | #include "printing/printing_export.h" |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 10 | #include "third_party/skia/include/core/SkRefCnt.h" |
11 | |||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 12 | namespace printing { |
13 | |||||
vitalybuka | a68e23e | 2014-09-12 00:59:12 | [diff] [blame] | 14 | class PdfMetafileSkia; |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 15 | |
vitalybuka | a68e23e | 2014-09-12 00:59:12 | [diff] [blame] | 16 | // A wrapper class with static methods to set and retrieve a PdfMetafileSkia |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 17 | // on an SkCanvas. The ownership of the metafile is not affected and it |
18 | // is the caller's responsibility to ensure that the metafile remains valid | ||||
19 | // as long as the canvas. | ||||
[email protected] | 69f5b1e6 | 2011-09-01 06:34:04 | [diff] [blame] | 20 | class PRINTING_EXPORT MetafileSkiaWrapper : public SkRefCnt { |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 21 | public: |
enne | 7b64edf3 | 2017-02-16 20:10:02 | [diff] [blame] | 22 | static void SetMetafileOnCanvas(cc::PaintCanvas* canvas, |
vitalybuka | a68e23e | 2014-09-12 00:59:12 | [diff] [blame] | 23 | PdfMetafileSkia* metafile); |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 24 | |
enne | 7b64edf3 | 2017-02-16 20:10:02 | [diff] [blame] | 25 | static PdfMetafileSkia* GetMetafileFromCanvas(cc::PaintCanvas* canvas); |
[email protected] | 926ae24 | 2011-08-02 02:07:08 | [diff] [blame] | 26 | |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 27 | private: |
vitalybuka | a68e23e | 2014-09-12 00:59:12 | [diff] [blame] | 28 | explicit MetafileSkiaWrapper(PdfMetafileSkia* metafile); |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 29 | |
vitalybuka | a68e23e | 2014-09-12 00:59:12 | [diff] [blame] | 30 | PdfMetafileSkia* metafile_; |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 31 | }; |
32 | |||||
33 | } // namespace printing | ||||
34 | |||||
35 | #endif // PRINTING_METAFILE_SKIA_WRAPPER_H_ |