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/pdf_metafile_skia.h" | 5 #include "printing/pdf_metafile_skia.h" |
6 | 6 |
7 #include "base/eintr_wrapper.h" | 7 #include "base/eintr_wrapper.h" |
8 #include "base/file_descriptor_posix.h" | 8 #include "base/file_descriptor_posix.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "skia/ext/vector_platform_device_skia.h" | 10 #include "skia/ext/vector_platform_device_skia.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 PdfMetafileSkia::~PdfMetafileSkia() {} | 29 PdfMetafileSkia::~PdfMetafileSkia() {} |
30 | 30 |
31 bool PdfMetafileSkia::Init() { | 31 bool PdfMetafileSkia::Init() { |
32 return true; | 32 return true; |
33 } | 33 } |
34 bool PdfMetafileSkia::InitFromData(const void* src_buffer, | 34 bool PdfMetafileSkia::InitFromData(const void* src_buffer, |
35 uint32 src_buffer_size) { | 35 uint32 src_buffer_size) { |
36 return data_->pdf_stream_.write(src_buffer, src_buffer_size); | 36 return data_->pdf_stream_.write(src_buffer, src_buffer_size); |
37 } | 37 } |
38 | 38 |
39 skia::PlatformDevice* PdfMetafileSkia::StartPageForVectorCanvas( | 39 SkDevice* PdfMetafileSkia::StartPageForVectorCanvas( |
40 const gfx::Size& page_size, const gfx::Rect& content_area, | 40 const gfx::Size& page_size, const gfx::Rect& content_area, |
41 const float& scale_factor) { | 41 const float& scale_factor) { |
42 DCHECK(data_->current_page_.get() == NULL); | 42 DCHECK(data_->current_page_.get() == NULL); |
43 | 43 |
44 // Adjust for the margins and apply the scale factor. | 44 // Adjust for the margins and apply the scale factor. |
45 SkMatrix transform; | 45 SkMatrix transform; |
46 transform.setTranslate(SkIntToScalar(content_area.x()), | 46 transform.setTranslate(SkIntToScalar(content_area.x()), |
47 SkIntToScalar(content_area.y())); | 47 SkIntToScalar(content_area.y())); |
48 transform.preScale(SkFloatToScalar(scale_factor), | 48 transform.preScale(SkFloatToScalar(scale_factor), |
49 SkFloatToScalar(scale_factor)); | 49 SkFloatToScalar(scale_factor)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 result = false; | 168 result = false; |
169 } | 169 } |
170 } | 170 } |
171 return result; | 171 return result; |
172 } | 172 } |
173 #endif | 173 #endif |
174 | 174 |
175 PdfMetafileSkia::PdfMetafileSkia() : data_(new PdfMetafileSkiaData) {} | 175 PdfMetafileSkia::PdfMetafileSkia() : data_(new PdfMetafileSkiaData) {} |
176 | 176 |
177 } // namespace printing | 177 } // namespace printing |
OLD | NEW |