| 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 10 matching lines...) Expand all  Loading... | 
| 21 class FilePath; | 21 class FilePath; | 
| 22 } | 22 } | 
| 23 | 23 | 
| 24 namespace gfx { | 24 namespace gfx { | 
| 25 class Rect; | 25 class Rect; | 
| 26 class Size; | 26 class Size; | 
| 27 } | 27 } | 
| 28 | 28 | 
| 29 namespace printing { | 29 namespace printing { | 
| 30 | 30 | 
| 31 // http://msdn2.microsoft.com/en-us/library/ms535522.aspx |  | 
| 32 // Windows 2000/XP: When a page in a spooled file exceeds approximately 350 |  | 
| 33 // MB, it can fail to print and not send an error message. |  | 
| 34 const size_t kMetafileMaxSize = 350*1024*1024; |  | 
| 35 |  | 
| 36 // Simple wrapper class that manage an EMF data stream and its virtual HDC. | 31 // Simple wrapper class that manage an EMF data stream and its virtual HDC. | 
| 37 class PRINTING_EXPORT Emf : public Metafile { | 32 class PRINTING_EXPORT Emf : public Metafile { | 
| 38  public: | 33  public: | 
| 39   class Record; | 34   class Record; | 
| 40   class Enumerator; | 35   class Enumerator; | 
| 41   struct EnumerationContext; | 36   struct EnumerationContext; | 
| 42 | 37 | 
| 43   // Generates a virtual HDC that will record every GDI commands and compile | 38   // Generates a virtual HDC that will record every GDI commands and compile | 
| 44   // it in a EMF data stream. | 39   // it in a EMF data stream. | 
| 45   Emf(); | 40   Emf(); | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 75   // Should be passed to Playback to keep the exact same size. | 70   // Should be passed to Playback to keep the exact same size. | 
| 76   gfx::Rect GetPageBounds(unsigned int page_number) const override; | 71   gfx::Rect GetPageBounds(unsigned int page_number) const override; | 
| 77 | 72 | 
| 78   unsigned int GetPageCount() const override; | 73   unsigned int GetPageCount() const override; | 
| 79   HDC context() const override; | 74   HDC context() const override; | 
| 80   bool Playback(HDC hdc, const RECT* rect) const override; | 75   bool Playback(HDC hdc, const RECT* rect) const override; | 
| 81   bool SafePlayback(HDC hdc) const override; | 76   bool SafePlayback(HDC hdc) const override; | 
| 82 | 77 | 
| 83   HENHMETAFILE emf() const { return emf_; } | 78   HENHMETAFILE emf() const { return emf_; } | 
| 84 | 79 | 
| 85   // Returns true if metafile contains alpha blend. |  | 
| 86   bool IsAlphaBlendUsed() const; |  | 
| 87 |  | 
| 88   // Returns new metafile with only bitmap created by playback of the current |  | 
| 89   // metafile. Returns NULL if fails. |  | 
| 90   std::unique_ptr<Emf> RasterizeMetafile(int raster_area_in_pixels) const; |  | 
| 91 |  | 
| 92   // Returns new metafile where AlphaBlend replaced by bitmaps. Returns NULL |  | 
| 93   // if fails. |  | 
| 94   std::unique_ptr<Emf> RasterizeAlphaBlend() const; |  | 
| 95 |  | 
| 96  private: | 80  private: | 
| 97   FRIEND_TEST_ALL_PREFIXES(EmfTest, DC); | 81   FRIEND_TEST_ALL_PREFIXES(EmfTest, DC); | 
| 98   FRIEND_TEST_ALL_PREFIXES(EmfPrintingTest, PageBreak); | 82   FRIEND_TEST_ALL_PREFIXES(EmfPrintingTest, PageBreak); | 
| 99   FRIEND_TEST_ALL_PREFIXES(EmfTest, FileBackedEmf); | 83   FRIEND_TEST_ALL_PREFIXES(EmfTest, FileBackedEmf); | 
| 100 | 84 | 
| 101   // Playbacks safely one EMF record. | 85   // Playbacks safely one EMF record. | 
| 102   static int CALLBACK SafePlaybackProc(HDC hdc, | 86   static int CALLBACK SafePlaybackProc(HDC hdc, | 
| 103                                        HANDLETABLE* handle_table, | 87                                        HANDLETABLE* handle_table, | 
| 104                                        const ENHMETARECORD* record, | 88                                        const ENHMETARECORD* record, | 
| 105                                        int objects_count, | 89                                        int objects_count, | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 184   std::vector<Record> items_; | 168   std::vector<Record> items_; | 
| 185 | 169 | 
| 186   EnumerationContext context_; | 170   EnumerationContext context_; | 
| 187 | 171 | 
| 188   DISALLOW_COPY_AND_ASSIGN(Enumerator); | 172   DISALLOW_COPY_AND_ASSIGN(Enumerator); | 
| 189 }; | 173 }; | 
| 190 | 174 | 
| 191 }  // namespace printing | 175 }  // namespace printing | 
| 192 | 176 | 
| 193 #endif  // PRINTING_EMF_WIN_H_ | 177 #endif  // PRINTING_EMF_WIN_H_ | 
| OLD | NEW | 
|---|