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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool FinishDocument() override; | 70 bool FinishDocument() override; |
71 | 71 |
72 uint32_t GetDataSize() const override; | 72 uint32_t GetDataSize() const override; |
73 bool GetData(void* buffer, uint32_t size) const override; | 73 bool GetData(void* buffer, uint32_t size) const override; |
74 | 74 |
75 // Should be passed to Playback to keep the exact same size. | 75 // Should be passed to Playback to keep the exact same size. |
76 gfx::Rect GetPageBounds(unsigned int page_number) const override; | 76 gfx::Rect GetPageBounds(unsigned int page_number) const override; |
77 | 77 |
78 unsigned int GetPageCount() const override; | 78 unsigned int GetPageCount() const override; |
79 HDC context() const override; | 79 HDC context() const override; |
80 | 80 bool Playback(HDC hdc, const RECT* rect) const override; |
81 bool SafePlayback(HDC hdc) const override; | 81 bool SafePlayback(HDC hdc) const override; |
82 | 82 |
83 // "Plays" the EMF buffer in a HDC. It is the same effect as calling the | |
84 // original GDI function that were called when recording the EMF. |rect| is in | |
85 // "logical units" and is optional. If |rect| is NULL, the natural EMF bounds | |
86 // are used. | |
87 // Note: Windows has been known to have stack buffer overflow in its GDI | |
88 // functions, whether used directly or indirectly through precompiled EMF | |
89 // data. We have to accept the risk here. Since it is used only for printing, | |
90 // it requires user intervention. | |
91 bool Playback(HDC hdc, const RECT* rect) const; | |
92 | |
93 HENHMETAFILE emf() const { return emf_; } | 83 HENHMETAFILE emf() const { return emf_; } |
94 | 84 |
95 // Returns true if metafile contains alpha blend. | 85 // Returns true if metafile contains alpha blend. |
96 bool IsAlphaBlendUsed() const; | 86 bool IsAlphaBlendUsed() const; |
97 | 87 |
98 // Returns new metafile with only bitmap created by playback of the current | 88 // Returns new metafile with only bitmap created by playback of the current |
99 // metafile. Returns NULL if fails. | 89 // metafile. Returns NULL if fails. |
100 std::unique_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; | 90 std::unique_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; |
101 | 91 |
102 // Returns new metafile where AlphaBlend replaced by bitmaps. Returns NULL | 92 // Returns new metafile where AlphaBlend replaced by bitmaps. Returns NULL |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 std::vector<Record> items_; | 184 std::vector<Record> items_; |
195 | 185 |
196 EnumerationContext context_; | 186 EnumerationContext context_; |
197 | 187 |
198 DISALLOW_COPY_AND_ASSIGN(Enumerator); | 188 DISALLOW_COPY_AND_ASSIGN(Enumerator); |
199 }; | 189 }; |
200 | 190 |
201 } // namespace printing | 191 } // namespace printing |
202 | 192 |
203 #endif // PRINTING_EMF_WIN_H_ | 193 #endif // PRINTING_EMF_WIN_H_ |
OLD | NEW |