| OLD | NEW |
| 1 // Copyright (c) 2011 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 #include "printing/image.h" | 5 #include "printing/image.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
| 10 #include "printing/metafile.h" | 10 #include "printing/metafile.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 data_.resize(bytes); | 27 data_.resize(bytes); |
| 28 base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( | 28 base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
| 29 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); | 29 CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); |
| 30 base::mac::ScopedCFTypeRef<CGContextRef> bitmap_context( | 30 base::mac::ScopedCFTypeRef<CGContextRef> bitmap_context( |
| 31 CGBitmapContextCreate(&*data_.begin(), size_.width(), size_.height(), | 31 CGBitmapContextCreate(&*data_.begin(), size_.width(), size_.height(), |
| 32 8, row_length_, color_space, | 32 8, row_length_, color_space, |
| 33 kCGImageAlphaPremultipliedLast)); | 33 kCGImageAlphaPremultipliedLast)); |
| 34 DCHECK(bitmap_context.get()); | 34 DCHECK(bitmap_context.get()); |
| 35 | 35 |
| 36 struct Metafile::MacRenderPageParams params; |
| 37 params.shrink_to_fit = true; |
| 38 params.stretch_to_fit = false; |
| 39 params.center_horizontally = false; |
| 40 params.center_vertically = false; |
| 41 params.autorotate = false; |
| 36 metafile.RenderPage(page_number, bitmap_context, | 42 metafile.RenderPage(page_number, bitmap_context, |
| 37 CGRectMake(0, 0, size_.width(), size_.height()), | 43 CGRectMake(0, 0, size_.width(), size_.height()), params); |
| 38 true, false, false, false); | |
| 39 | 44 |
| 40 return true; | 45 return true; |
| 41 } | 46 } |
| 42 | 47 |
| 43 } // namespace printing | 48 } // namespace printing |
| OLD | NEW |