| 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 #ifndef PRINTING_PDF_METAFILE_SKIA_H_ | 5 #ifndef PRINTING_PDF_METAFILE_SKIA_H_ |
| 6 #define PRINTING_PDF_METAFILE_SKIA_H_ | 6 #define PRINTING_PDF_METAFILE_SKIA_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "cc/paint/paint_canvas.h" |
| 14 #include "printing/metafile.h" | 15 #include "printing/metafile.h" |
| 15 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
| 16 | 17 |
| 17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 18 #include <windows.h> | 19 #include <windows.h> |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 class SkCanvas; | |
| 22 | |
| 23 namespace printing { | 22 namespace printing { |
| 24 | 23 |
| 25 enum SkiaDocumentType { | 24 enum SkiaDocumentType { |
| 26 PDF_SKIA_DOCUMENT_TYPE, | 25 PDF_SKIA_DOCUMENT_TYPE, |
| 27 // MSKP is an experimental, fragile, and diagnostic-only document type. | 26 // MSKP is an experimental, fragile, and diagnostic-only document type. |
| 28 MSKP_SKIA_DOCUMENT_TYPE, | 27 MSKP_SKIA_DOCUMENT_TYPE, |
| 29 }; | 28 }; |
| 30 | 29 |
| 31 struct PdfMetafileSkiaData; | 30 struct PdfMetafileSkiaData; |
| 32 | 31 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #endif | 65 #endif |
| 67 | 66 |
| 68 bool SaveTo(base::File* file) const override; | 67 bool SaveTo(base::File* file) const override; |
| 69 | 68 |
| 70 // Return a new metafile containing just the current page in draft mode. | 69 // Return a new metafile containing just the current page in draft mode. |
| 71 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage( | 70 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage( |
| 72 SkiaDocumentType type); | 71 SkiaDocumentType type); |
| 73 | 72 |
| 74 // This method calls StartPage and then returns an appropriate | 73 // This method calls StartPage and then returns an appropriate |
| 75 // PlatformCanvas implementation bound to the context created by | 74 // PlatformCanvas implementation bound to the context created by |
| 76 // StartPage or NULL on error. The SkCanvas pointer that | 75 // StartPage or NULL on error. The PaintCanvas pointer that |
| 77 // is returned is owned by this PdfMetafileSkia object and does not | 76 // is returned is owned by this PdfMetafileSkia object and does not |
| 78 // need to be ref()ed or unref()ed. The canvas will remain valid | 77 // need to be ref()ed or unref()ed. The canvas will remain valid |
| 79 // until FinishPage() or FinishDocument() is called. | 78 // until FinishPage() or FinishDocument() is called. |
| 80 SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size, | 79 cc::PaintCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size, |
| 81 const gfx::Rect& content_area, | 80 const gfx::Rect& content_area, |
| 82 const float& scale_factor); | 81 const float& scale_factor); |
| 83 | 82 |
| 84 private: | 83 private: |
| 85 std::unique_ptr<PdfMetafileSkiaData> data_; | 84 std::unique_ptr<PdfMetafileSkiaData> data_; |
| 86 | 85 |
| 87 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); | 86 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 } // namespace printing | 89 } // namespace printing |
| 91 | 90 |
| 92 #endif // PRINTING_PDF_METAFILE_SKIA_H_ | 91 #endif // PRINTING_PDF_METAFILE_SKIA_H_ |
| OLD | NEW |