OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "skia/ext/platform_device.h" | 7 #include "skia/ext/platform_device.h" |
8 #include "ui/gfx/gdi_util.h" // EMF support | 8 #include "ui/gfx/gdi_util.h" // EMF support |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 bool enable_again_; | 38 bool enable_again_; |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(DisableFontSmoothing); | 40 DISALLOW_COPY_AND_ASSIGN(DisableFontSmoothing); |
41 }; | 41 }; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 namespace printing { | 45 namespace printing { |
46 | 46 |
47 bool Image::LoadMetafile(const NativeMetafile& metafile) { | 47 bool Image::LoadMetafile(const NativeMetafile& metafile) { |
48 gfx::Rect rect(metafile.GetBounds()); | 48 gfx::Rect rect(metafile.GetPageBounds(1)); |
49 DisableFontSmoothing disable_in_this_scope; | 49 DisableFontSmoothing disable_in_this_scope; |
50 | 50 |
51 // Create a temporary HDC and bitmap to retrieve the rendered data. | 51 // Create a temporary HDC and bitmap to retrieve the rendered data. |
52 HDC hdc = CreateCompatibleDC(NULL); | 52 HDC hdc = CreateCompatibleDC(NULL); |
53 BITMAPV4HEADER hdr; | 53 BITMAPV4HEADER hdr; |
54 DCHECK_EQ(rect.x(), 0); | 54 DCHECK_EQ(rect.x(), 0); |
55 DCHECK_EQ(rect.y(), 0); | 55 DCHECK_EQ(rect.y(), 0); |
56 DCHECK_GE(rect.width(), 0); // Metafile could be empty. | 56 DCHECK_GE(rect.width(), 0); // Metafile could be empty. |
57 DCHECK_GE(rect.height(), 0); | 57 DCHECK_GE(rect.height(), 0); |
58 | 58 |
(...skipping 20 matching lines...) Expand all Loading... |
79 data_.resize(bytes); | 79 data_.resize(bytes); |
80 memcpy(&*data_.begin(), bits, bytes); | 80 memcpy(&*data_.begin(), bits, bytes); |
81 | 81 |
82 DeleteDC(hdc); | 82 DeleteDC(hdc); |
83 DeleteObject(bitmap); | 83 DeleteObject(bitmap); |
84 | 84 |
85 return success; | 85 return success; |
86 } | 86 } |
87 | 87 |
88 } // namespace printing | 88 } // namespace printing |
OLD | NEW |