| OLD | NEW |
| 1 // Copyright (c) 2011 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/printed_document.h" | 5 #include "printing/printed_document.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "printing/page_number.h" | 8 #include "printing/page_number.h" |
| 9 #include "printing/printed_pages_source.h" | 9 #include "printing/printed_pages_source.h" |
| 10 #include "printing/printed_page.h" | 10 #include "printing/printed_page.h" |
| 11 #include "printing/units.h" | 11 #include "printing/units.h" |
| 12 #include "skia/ext/platform_device.h" | 12 #include "skia/ext/platform_device.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 void SimpleModifyWorldTransform(HDC context, | 16 void SimpleModifyWorldTransform(HDC context, |
| 17 int offset_x, | 17 int offset_x, |
| 18 int offset_y, | 18 int offset_y, |
| 19 float shrink_factor) { | 19 float shrink_factor) { |
| 20 XFORM xform = { 0 }; | 20 XFORM xform = { 0 }; |
| 21 xform.eDx = static_cast<float>(offset_x); | 21 xform.eDx = static_cast<float>(offset_x); |
| 22 xform.eDy = static_cast<float>(offset_y); | 22 xform.eDy = static_cast<float>(offset_y); |
| 23 xform.eM11 = xform.eM22 = 1.f / shrink_factor; | 23 xform.eM11 = xform.eM22 = 1.f / shrink_factor; |
| 24 BOOL res = ModifyWorldTransform(context, &xform, MWT_LEFTMULTIPLY); | 24 BOOL res = ModifyWorldTransform(context, &xform, MWT_LEFTMULTIPLY); |
| 25 DCHECK_NE(res, 0); | 25 DCHECK_NE(res, 0); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void DrawRect(HDC context, gfx::Rect rect) { | |
| 29 Rectangle(context, rect.x(), rect.y(), rect.right(), rect.bottom()); | |
| 30 } | |
| 31 | |
| 32 } // namespace | 28 } // namespace |
| 33 | 29 |
| 34 namespace printing { | 30 namespace printing { |
| 35 | 31 |
| 36 void PrintedDocument::RenderPrintedPage( | 32 void PrintedDocument::RenderPrintedPage( |
| 37 const PrintedPage& page, gfx::NativeDrawingContext context) const { | 33 const PrintedPage& page, gfx::NativeDrawingContext context) const { |
| 38 #ifndef NDEBUG | 34 #ifndef NDEBUG |
| 39 { | 35 { |
| 40 // Make sure the page is from our list. | 36 // Make sure the page is from our list. |
| 41 base::AutoLock lock(lock_); | 37 base::AutoLock lock(lock_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 73 |
| 78 BOOL res = RestoreDC(context, saved_state); | 74 BOOL res = RestoreDC(context, saved_state); |
| 79 DCHECK_NE(res, 0); | 75 DCHECK_NE(res, 0); |
| 80 } | 76 } |
| 81 | 77 |
| 82 int res = RestoreDC(context, saved_state); | 78 int res = RestoreDC(context, saved_state); |
| 83 DCHECK_NE(res, 0); | 79 DCHECK_NE(res, 0); |
| 84 } | 80 } |
| 85 | 81 |
| 86 } // namespace printing | 82 } // namespace printing |
| OLD | NEW |