Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: printing/emf_win.h

Issue 10836330: Rasterize page before printing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "printing/metafile.h" 15 #include "printing/metafile.h"
16 16
17 class FilePath; 17 class FilePath;
18 18
19 namespace gfx { 19 namespace gfx {
20 class Rect; 20 class Rect;
21 class Size; 21 class Size;
22 } 22 }
23 23
24 namespace printing { 24 namespace printing {
25 25
26 // http://msdn2.microsoft.com/en-us/library/ms535522.aspx
27 // Windows 2000/XP: When a page in a spooled file exceeds approximately 350
28 // MB, it can fail to print and not send an error message.
29 const size_t kMetafileMaxSize = 350*1024*1024;
30
26 // 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.
27 class PRINTING_EXPORT Emf : public Metafile { 32 class PRINTING_EXPORT Emf : public Metafile {
28 public: 33 public:
29 class Record; 34 class Record;
30 class Enumerator; 35 class Enumerator;
31 struct EnumerationContext; 36 struct EnumerationContext;
32 37
33 // 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
34 // it in a EMF data stream. 39 // it in a EMF data stream.
35 Emf(); 40 Emf();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // The collection of every EMF records in the currently loaded EMF buffer. 182 // The collection of every EMF records in the currently loaded EMF buffer.
178 // Initialized by Enumerate(). It keeps pointers to the EMF buffer held by 183 // Initialized by Enumerate(). It keeps pointers to the EMF buffer held by
179 // Emf::emf_. The entries become invalid once Emf::CloseEmf() is called. 184 // Emf::emf_. The entries become invalid once Emf::CloseEmf() is called.
180 std::vector<Record> items_; 185 std::vector<Record> items_;
181 186
182 EnumerationContext context_; 187 EnumerationContext context_;
183 188
184 DISALLOW_COPY_AND_ASSIGN(Enumerator); 189 DISALLOW_COPY_AND_ASSIGN(Enumerator);
185 }; 190 };
186 191
192 // Returns true if metafile contains alpha blend.
193 PRINTING_EXPORT bool IsAlphaBlendUsed(const Emf& metafile);
194
195 // Returns new metafile with only bitmap created by playback of the current
196 // metafile. Returns NULL if fails.
197 PRINTING_EXPORT Emf* RasterizeMetafile(const Emf& metafile,
198 int raster_area_in_pixels);
199
187 } // namespace printing 200 } // namespace printing
188 201
189 #endif // PRINTING_EMF_WIN_H_ 202 #endif // PRINTING_EMF_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698