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_EMF_WIN_H_ | 5 #ifndef PRINTING_EMF_WIN_H_ |
6 #define PRINTING_EMF_WIN_H_ | 6 #define PRINTING_EMF_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 void Close(); | 47 void Close(); |
48 | 48 |
49 // Generates a new metafile that will record every GDI command, and will | 49 // Generates a new metafile that will record every GDI command, and will |
50 // be saved to |metafile_path|. | 50 // be saved to |metafile_path|. |
51 bool InitToFile(const base::FilePath& metafile_path); | 51 bool InitToFile(const base::FilePath& metafile_path); |
52 | 52 |
53 // Initializes the Emf with the data in |metafile_path|. | 53 // Initializes the Emf with the data in |metafile_path|. |
54 bool InitFromFile(const base::FilePath& metafile_path); | 54 bool InitFromFile(const base::FilePath& metafile_path); |
55 | 55 |
56 // Metafile methods. | 56 // Metafile methods. |
57 virtual bool Init() OVERRIDE; | 57 virtual bool Init() override; |
58 virtual bool InitFromData(const void* src_buffer, | 58 virtual bool InitFromData(const void* src_buffer, |
59 uint32 src_buffer_size) OVERRIDE; | 59 uint32 src_buffer_size) override; |
60 | 60 |
61 virtual SkBaseDevice* StartPageForVectorCanvas( | 61 virtual SkBaseDevice* StartPageForVectorCanvas( |
62 const gfx::Size& page_size, const gfx::Rect& content_area, | 62 const gfx::Size& page_size, const gfx::Rect& content_area, |
63 const float& scale_factor) OVERRIDE; | 63 const float& scale_factor) override; |
64 // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls | 64 // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls |
65 // (since StartPage and EndPage do not work in a metafile DC). Only valid | 65 // (since StartPage and EndPage do not work in a metafile DC). Only valid |
66 // when hdc_ is non-NULL. |page_size|, |content_area|, and |scale_factor| are | 66 // when hdc_ is non-NULL. |page_size|, |content_area|, and |scale_factor| are |
67 // ignored. | 67 // ignored. |
68 virtual bool StartPage(const gfx::Size& page_size, | 68 virtual bool StartPage(const gfx::Size& page_size, |
69 const gfx::Rect& content_area, | 69 const gfx::Rect& content_area, |
70 const float& scale_factor) OVERRIDE; | 70 const float& scale_factor) override; |
71 virtual bool FinishPage() OVERRIDE; | 71 virtual bool FinishPage() override; |
72 virtual bool FinishDocument() OVERRIDE; | 72 virtual bool FinishDocument() override; |
73 | 73 |
74 virtual uint32 GetDataSize() const OVERRIDE; | 74 virtual uint32 GetDataSize() const override; |
75 virtual bool GetData(void* buffer, uint32 size) const OVERRIDE; | 75 virtual bool GetData(void* buffer, uint32 size) const override; |
76 | 76 |
77 // Should be passed to Playback to keep the exact same size. | 77 // Should be passed to Playback to keep the exact same size. |
78 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE; | 78 virtual gfx::Rect GetPageBounds(unsigned int page_number) const override; |
79 | 79 |
80 virtual unsigned int GetPageCount() const OVERRIDE { return 1; } | 80 virtual unsigned int GetPageCount() const override { return 1; } |
81 | 81 |
82 virtual HDC context() const OVERRIDE { | 82 virtual HDC context() const override { |
83 return hdc_; | 83 return hdc_; |
84 } | 84 } |
85 | 85 |
86 virtual bool Playback(HDC hdc, const RECT* rect) const OVERRIDE; | 86 virtual bool Playback(HDC hdc, const RECT* rect) const override; |
87 virtual bool SafePlayback(HDC hdc) const OVERRIDE; | 87 virtual bool SafePlayback(HDC hdc) const override; |
88 | 88 |
89 HENHMETAFILE emf() const { return emf_; } | 89 HENHMETAFILE emf() const { return emf_; } |
90 | 90 |
91 // Returns true if metafile contains alpha blend. | 91 // Returns true if metafile contains alpha blend. |
92 bool IsAlphaBlendUsed() const; | 92 bool IsAlphaBlendUsed() const; |
93 | 93 |
94 // Returns new metafile with only bitmap created by playback of the current | 94 // Returns new metafile with only bitmap created by playback of the current |
95 // metafile. Returns NULL if fails. | 95 // metafile. Returns NULL if fails. |
96 scoped_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; | 96 scoped_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; |
97 | 97 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 std::vector<Record> items_; | 188 std::vector<Record> items_; |
189 | 189 |
190 EnumerationContext context_; | 190 EnumerationContext context_; |
191 | 191 |
192 DISALLOW_COPY_AND_ASSIGN(Enumerator); | 192 DISALLOW_COPY_AND_ASSIGN(Enumerator); |
193 }; | 193 }; |
194 | 194 |
195 } // namespace printing | 195 } // namespace printing |
196 | 196 |
197 #endif // PRINTING_EMF_WIN_H_ | 197 #endif // PRINTING_EMF_WIN_H_ |
OLD | NEW |