OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PDF_METAFILE_SKIA_H_ | 5 #ifndef PRINTING_PDF_METAFILE_SKIA_H_ |
6 #define PRINTING_PDF_METAFILE_SKIA_H_ | 6 #define PRINTING_PDF_METAFILE_SKIA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "printing/native_metafile.h" | 12 #include "printing/metafile.h" |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include <windows.h> | 15 #include <windows.h> |
16 #endif | 16 #endif |
17 | 17 |
18 namespace printing { | 18 namespace printing { |
19 | 19 |
20 struct PdfMetafileSkiaData; | 20 struct PdfMetafileSkiaData; |
21 | 21 |
22 // This class uses Skia graphics library to generate a PDF document. | 22 // This class uses Skia graphics library to generate a PDF document. |
23 class PdfMetafileSkia : public NativeMetafile { | 23 class PdfMetafileSkia : public Metafile { |
24 public: | 24 public: |
| 25 PdfMetafileSkia(); |
25 virtual ~PdfMetafileSkia(); | 26 virtual ~PdfMetafileSkia(); |
26 | 27 |
27 // NativeMetafile interface | 28 // Metafile methods. |
28 virtual bool Init(); | 29 virtual bool Init(); |
29 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); | 30 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); |
30 | 31 |
31 virtual skia::PlatformDevice* StartPageForVectorCanvas( | 32 virtual skia::PlatformDevice* StartPageForVectorCanvas( |
32 const gfx::Size& page_size, | 33 const gfx::Size& page_size, |
33 const gfx::Point& content_origin, | 34 const gfx::Point& content_origin, |
34 const float& scale_factor); | 35 const float& scale_factor); |
35 virtual bool StartPage(const gfx::Size& page_size, | 36 virtual bool StartPage(const gfx::Size& page_size, |
36 const gfx::Point& content_origin, | 37 const gfx::Point& content_origin, |
37 const float& scale_factor); | 38 const float& scale_factor); |
(...skipping 10 matching lines...) Expand all Loading... |
48 | 49 |
49 virtual gfx::NativeDrawingContext context() const; | 50 virtual gfx::NativeDrawingContext context() const; |
50 | 51 |
51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
52 virtual bool Playback(gfx::NativeDrawingContext hdc, const RECT* rect) const; | 53 virtual bool Playback(gfx::NativeDrawingContext hdc, const RECT* rect) const; |
53 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const; | 54 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const; |
54 virtual HENHMETAFILE emf() const; | 55 virtual HENHMETAFILE emf() const; |
55 #endif // if defined(OS_WIN) | 56 #endif // if defined(OS_WIN) |
56 | 57 |
57 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
58 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | 59 virtual bool SaveToFD(const base::FileDescriptor& fd) const; |
59 #endif // if defined(OS_CHROMEOS) | 60 #endif // if defined(OS_CHROMEOS) |
60 | |
61 protected: | |
62 PdfMetafileSkia(); | |
63 | |
64 private: | 61 private: |
65 friend class NativeMetafileFactory; | |
66 | |
67 scoped_ptr<PdfMetafileSkiaData> data_; | 62 scoped_ptr<PdfMetafileSkiaData> data_; |
68 | 63 |
69 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); | 64 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); |
70 }; | 65 }; |
71 | 66 |
72 } // namespace printing | 67 } // namespace printing |
73 | 68 |
74 #endif // PRINTING_PDF_METAFILE_MAC_H_ | 69 #endif // PRINTING_PDF_METAFILE_MAC_H_ |
OLD | NEW |