[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 | |||||
[email protected] | 69f5b1e6 | 2011-09-01 06:34:04 | [diff] [blame] | 8 | #include "printing/printing_export.h" |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 9 | #include "third_party/skia/include/core/SkRefCnt.h" |
10 | |||||
11 | class SkCanvas; | ||||
12 | |||||
13 | namespace printing { | ||||
14 | |||||
15 | class Metafile; | ||||
16 | |||||
17 | // A wrapper class with static methods to set and retrieve a Metafile | ||||
18 | // 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 | ||||
20 | // as long as the canvas. | ||||
[email protected] | 69f5b1e6 | 2011-09-01 06:34:04 | [diff] [blame] | 21 | class PRINTING_EXPORT MetafileSkiaWrapper : public SkRefCnt { |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 22 | public: |
[email protected] | be44f2f5 | 2011-09-28 03:07:34 | [diff] [blame] | 23 | static void SetMetafileOnCanvas(const SkCanvas& canvas, Metafile* metafile); |
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 24 | |
[email protected] | be44f2f5 | 2011-09-28 03:07:34 | [diff] [blame] | 25 | static Metafile* GetMetafileFromCanvas(const SkCanvas& canvas); |
[email protected] | 926ae24 | 2011-08-02 02:07:08 | [diff] [blame] | 26 | |
[email protected] | f64d7a35 | 2012-05-09 17:22:21 | [diff] [blame] | 27 | // Methods to set and retrieve custom scale factor for metafile from canvas. |
28 | static void SetCustomScaleOnCanvas(const SkCanvas& canvas, double scale); | ||||
29 | static bool GetCustomScaleOnCanvas(const SkCanvas& canvas, double* scale); | ||||
30 | |||||
[email protected] | 7d748990 | 2011-04-11 21:54:06 | [diff] [blame] | 31 | private: |
32 | explicit MetafileSkiaWrapper(Metafile* metafile); | ||||
33 | |||||
34 | Metafile* metafile_; | ||||
35 | }; | ||||
36 | |||||
37 | } // namespace printing | ||||
38 | |||||
39 | #endif // PRINTING_METAFILE_SKIA_WRAPPER_H_ |