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

Side by Side Diff: printing/image_win.cc

Issue 6826027: Connect the right metafiles for print preview on Linux and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile problems Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « printing/image_mac.cc ('k') | printing/metafile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "printing/image.h" 5 #include "printing/image.h"
6 6
7 #include "printing/metafile.h"
7 #include "skia/ext/platform_device.h" 8 #include "skia/ext/platform_device.h"
8 #include "ui/gfx/gdi_util.h" // EMF support 9 #include "ui/gfx/gdi_util.h" // EMF support
9 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
10 11
11 namespace { 12 namespace {
12 13
13 // A simple class which temporarily overrides system settings. 14 // A simple class which temporarily overrides system settings.
14 // The bitmap image rendered via the PlayEnhMetaFile() function depends on 15 // The bitmap image rendered via the PlayEnhMetaFile() function depends on
15 // some system settings. 16 // some system settings.
16 // As a workaround for such dependency, this class saves the system settings 17 // As a workaround for such dependency, this class saves the system settings
(...skipping 20 matching lines...) Expand all
37 private: 38 private:
38 bool enable_again_; 39 bool enable_again_;
39 40
40 DISALLOW_COPY_AND_ASSIGN(DisableFontSmoothing); 41 DISALLOW_COPY_AND_ASSIGN(DisableFontSmoothing);
41 }; 42 };
42 43
43 } // namespace 44 } // namespace
44 45
45 namespace printing { 46 namespace printing {
46 47
47 bool Image::LoadMetafile(const NativeMetafile& metafile) { 48 bool Image::LoadMetafile(const Metafile& metafile) {
48 gfx::Rect rect(metafile.GetPageBounds(1)); 49 gfx::Rect rect(metafile.GetPageBounds(1));
49 DisableFontSmoothing disable_in_this_scope; 50 DisableFontSmoothing disable_in_this_scope;
50 51
51 // Create a temporary HDC and bitmap to retrieve the rendered data. 52 // Create a temporary HDC and bitmap to retrieve the rendered data.
52 HDC hdc = CreateCompatibleDC(NULL); 53 HDC hdc = CreateCompatibleDC(NULL);
53 BITMAPV4HEADER hdr; 54 BITMAPV4HEADER hdr;
54 DCHECK_EQ(rect.x(), 0); 55 DCHECK_EQ(rect.x(), 0);
55 DCHECK_EQ(rect.y(), 0); 56 DCHECK_EQ(rect.y(), 0);
56 DCHECK_GE(rect.width(), 0); // Metafile could be empty. 57 DCHECK_GE(rect.width(), 0); // Metafile could be empty.
57 DCHECK_GE(rect.height(), 0); 58 DCHECK_GE(rect.height(), 0);
(...skipping 21 matching lines...) Expand all
79 data_.resize(bytes); 80 data_.resize(bytes);
80 memcpy(&*data_.begin(), bits, bytes); 81 memcpy(&*data_.begin(), bits, bytes);
81 82
82 DeleteDC(hdc); 83 DeleteDC(hdc);
83 DeleteObject(bitmap); 84 DeleteObject(bitmap);
84 85
85 return success; 86 return success;
86 } 87 }
87 88
88 } // namespace printing 89 } // namespace printing
OLDNEW
« no previous file with comments | « printing/image_mac.cc ('k') | printing/metafile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698