| OLD | NEW |
| 1 // Copyright (c) 2012 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/pdf_metafile_skia.h" | 5 #include "printing/pdf_metafile_skia.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/file_descriptor_posix.h" | |
| 9 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 10 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 11 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/posix/eintr_wrapper.h" | 11 #include "base/posix/eintr_wrapper.h" |
| 13 #include "skia/ext/refptr.h" | 12 #include "skia/ext/refptr.h" |
| 14 #include "skia/ext/vector_platform_device_skia.h" | 13 #include "skia/ext/vector_platform_device_skia.h" |
| 15 #include "third_party/skia/include/core/SkData.h" | 14 #include "third_party/skia/include/core/SkData.h" |
| 16 #include "third_party/skia/include/core/SkRefCnt.h" | 15 #include "third_party/skia/include/core/SkRefCnt.h" |
| 17 #include "third_party/skia/include/core/SkScalar.h" | 16 #include "third_party/skia/include/core/SkScalar.h" |
| 18 #include "third_party/skia/include/core/SkStream.h" | 17 #include "third_party/skia/include/core/SkStream.h" |
| 19 #include "third_party/skia/include/core/SkTypeface.h" | 18 #include "third_party/skia/include/core/SkTypeface.h" |
| 20 #include "third_party/skia/include/pdf/SkPDFDevice.h" | 19 #include "third_party/skia/include/pdf/SkPDFDevice.h" |
| 21 #include "third_party/skia/include/pdf/SkPDFDocument.h" | 20 #include "third_party/skia/include/pdf/SkPDFDocument.h" |
| 22 #include "ui/gfx/point.h" | 21 #include "ui/gfx/point.h" |
| 23 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 24 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 25 | 24 |
| 26 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 27 #include "printing/pdf_metafile_cg_mac.h" | 26 #include "printing/pdf_metafile_cg_mac.h" |
| 28 #endif | 27 #endif |
| 29 | 28 |
| 29 #if defined(OS_POSIX) |
| 30 #include "base/file_descriptor_posix.h" |
| 31 #endif |
| 32 |
| 30 namespace printing { | 33 namespace printing { |
| 31 | 34 |
| 32 struct PdfMetafileSkiaData { | 35 struct PdfMetafileSkiaData { |
| 33 skia::RefPtr<SkPDFDevice> current_page_; | 36 skia::RefPtr<SkPDFDevice> current_page_; |
| 34 SkPDFDocument pdf_doc_; | 37 SkPDFDocument pdf_doc_; |
| 35 SkDynamicMemoryWStream pdf_stream_; | 38 SkDynamicMemoryWStream pdf_stream_; |
| 36 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
| 37 PdfMetafileCg pdf_cg_; | 40 PdfMetafileCg pdf_cg_; |
| 38 #endif | 41 #endif |
| 39 }; | 42 }; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 if (data->size() == 0) | 242 if (data->size() == 0) |
| 240 return NULL; | 243 return NULL; |
| 241 | 244 |
| 242 PdfMetafileSkia* metafile = new PdfMetafileSkia; | 245 PdfMetafileSkia* metafile = new PdfMetafileSkia; |
| 243 metafile->InitFromData(data->bytes(), | 246 metafile->InitFromData(data->bytes(), |
| 244 base::checked_cast<uint32>(data->size())); | 247 base::checked_cast<uint32>(data->size())); |
| 245 return metafile; | 248 return metafile; |
| 246 } | 249 } |
| 247 | 250 |
| 248 } // namespace printing | 251 } // namespace printing |
| OLD | NEW |