| 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 bool Playback(HDC hdc, const RECT* rect) const override; | 80 |
| 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 |
| 83 HENHMETAFILE emf() const { return emf_; } | 93 HENHMETAFILE emf() const { return emf_; } |
| 84 | 94 |
| 85 // Returns true if metafile contains alpha blend. | 95 // Returns true if metafile contains alpha blend. |
| 86 bool IsAlphaBlendUsed() const; | 96 bool IsAlphaBlendUsed() const; |
| 87 | 97 |
| 88 // Returns new metafile with only bitmap created by playback of the current | 98 // Returns new metafile with only bitmap created by playback of the current |
| 89 // metafile. Returns NULL if fails. | 99 // metafile. Returns NULL if fails. |
| 90 std::unique_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; | 100 std::unique_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; |
| 91 | 101 |
| 92 // Returns new metafile where AlphaBlend replaced by bitmaps. Returns NULL | 102 // Returns new metafile where AlphaBlend replaced by bitmaps. Returns NULL |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 std::vector<Record> items_; | 194 std::vector<Record> items_; |
| 185 | 195 |
| 186 EnumerationContext context_; | 196 EnumerationContext context_; |
| 187 | 197 |
| 188 DISALLOW_COPY_AND_ASSIGN(Enumerator); | 198 DISALLOW_COPY_AND_ASSIGN(Enumerator); |
| 189 }; | 199 }; |
| 190 | 200 |
| 191 } // namespace printing | 201 } // namespace printing |
| 192 | 202 |
| 193 #endif // PRINTING_EMF_WIN_H_ | 203 #endif // PRINTING_EMF_WIN_H_ |
| OLD | NEW |