| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/mock_printer_driver_win.h" | 5 #include "chrome/renderer/mock_printer_driver_win.h" |
| 6 | 6 |
| 7 #include "base/gfx/gdi_util.h" | 7 #include "base/gfx/gdi_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/common/gfx/emf.h" | 9 #include "chrome/common/gfx/emf.h" |
| 10 #include "chrome/renderer/mock_printer.h" | 10 #include "chrome/renderer/mock_printer.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return NULL; | 68 return NULL; |
| 69 | 69 |
| 70 void* bits; | 70 void* bits; |
| 71 bitmap_ = CreateDIBSection(dc_, reinterpret_cast<BITMAPINFO*>(&header), 0, | 71 bitmap_ = CreateDIBSection(dc_, reinterpret_cast<BITMAPINFO*>(&header), 0, |
| 72 &bits, NULL, 0); | 72 &bits, NULL, 0); |
| 73 if (!bitmap_ || !bits) | 73 if (!bitmap_ || !bits) |
| 74 return NULL; | 74 return NULL; |
| 75 | 75 |
| 76 SelectObject(dc_, bitmap_); | 76 SelectObject(dc_, bitmap_); |
| 77 | 77 |
| 78 skia::PlatformDeviceWin::InitializeDC(dc_); | 78 skia::PlatformDevice::InitializeDC(dc_); |
| 79 emf->Playback(dc_, NULL); | 79 emf->Playback(dc_, NULL); |
| 80 | 80 |
| 81 return reinterpret_cast<uint8*>(bits); | 81 return reinterpret_cast<uint8*>(bits); |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 HDC dc_; | 85 HDC dc_; |
| 86 HBITMAP bitmap_; | 86 HBITMAP bitmap_; |
| 87 }; | 87 }; |
| 88 | 88 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 if (!bitmap_data) | 116 if (!bitmap_data) |
| 117 return NULL; | 117 return NULL; |
| 118 | 118 |
| 119 // Create a new MockPrinterPage instance and return it. | 119 // Create a new MockPrinterPage instance and return it. |
| 120 size_t row_byte_width = rect.width() * 4; | 120 size_t row_byte_width = rect.width() * 4; |
| 121 size_t bitmap_size = row_byte_width * rect.height(); | 121 size_t bitmap_size = row_byte_width * rect.height(); |
| 122 return new MockPrinterPage(rect.width(), rect.height(), | 122 return new MockPrinterPage(rect.width(), rect.height(), |
| 123 source_data, source_size, | 123 source_data, source_size, |
| 124 bitmap_data, bitmap_size); | 124 bitmap_data, bitmap_size); |
| 125 } | 125 } |
| OLD | NEW |