Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: printing/pdf_metafile_skia.h

Issue 2064843002: PdfMetafileSkia: start supporting more document types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('j') | printing/pdf_metafile_skia.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 10 matching lines...) Expand all
21 class SkCanvas; 21 class SkCanvas;
22 22
23 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 23 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
24 namespace base { 24 namespace base {
25 struct FileDescriptor; 25 struct FileDescriptor;
26 } 26 }
27 #endif 27 #endif
28 28
29 namespace printing { 29 namespace printing {
30 30
31 enum SkiaDocumentType {
32 PDF_SKIA_DOCUMENT_TYPE,
33 MSKP_SKIA_DOCUMENT_TYPE,
34 };
35
31 struct PdfMetafileSkiaData; 36 struct PdfMetafileSkiaData;
32 37
33 // This class uses Skia graphics library to generate a PDF document. 38 // This class uses Skia graphics library to generate a PDF document.
34 class PRINTING_EXPORT PdfMetafileSkia : public Metafile { 39 class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
35 public: 40 public:
36 PdfMetafileSkia(); 41 PdfMetafileSkia(SkiaDocumentType type = PDF_SKIA_DOCUMENT_TYPE);
Lei Zhang 2016/06/13 21:01:34 Highly prefer no default arguments, especially wit
Lei Zhang 2016/06/13 21:01:34 explicit
hal.canary 2016/06/14 16:34:49 Done.
hal.canary 2016/06/14 16:34:49 Done.
37 ~PdfMetafileSkia() override; 42 ~PdfMetafileSkia() override;
38 43
39 // Metafile methods. 44 // Metafile methods.
40 bool Init() override; 45 bool Init() override;
41 bool InitFromData(const void* src_buffer, uint32_t src_buffer_size) override; 46 bool InitFromData(const void* src_buffer, uint32_t src_buffer_size) override;
42 47
43 void StartPage(const gfx::Size& page_size, 48 void StartPage(const gfx::Size& page_size,
44 const gfx::Rect& content_area, 49 const gfx::Rect& content_area,
45 const float& scale_factor) override; 50 const float& scale_factor) override;
46 bool FinishPage() override; 51 bool FinishPage() override;
(...skipping 14 matching lines...) Expand all
61 #elif defined(OS_MACOSX) 66 #elif defined(OS_MACOSX)
62 bool RenderPage(unsigned int page_number, 67 bool RenderPage(unsigned int page_number,
63 gfx::NativeDrawingContext context, 68 gfx::NativeDrawingContext context,
64 const CGRect rect, 69 const CGRect rect,
65 const MacRenderPageParams& params) const override; 70 const MacRenderPageParams& params) const override;
66 #endif 71 #endif
67 72
68 bool SaveTo(base::File* file) const override; 73 bool SaveTo(base::File* file) const override;
69 74
70 // Return a new metafile containing just the current page in draft mode. 75 // Return a new metafile containing just the current page in draft mode.
71 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage(); 76 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage(
77 SkiaDocumentType type = PDF_SKIA_DOCUMENT_TYPE);
72 78
73 // This method calls StartPage and then returns an appropriate 79 // This method calls StartPage and then returns an appropriate
74 // PlatformCanvas implementation bound to the context created by 80 // PlatformCanvas implementation bound to the context created by
75 // StartPage or NULL on error. The SkCanvas pointer that 81 // StartPage or NULL on error. The SkCanvas pointer that
76 // is returned is owned by this PdfMetafileSkia object and does not 82 // is returned is owned by this PdfMetafileSkia object and does not
77 // need to be ref()ed or unref()ed. The canvas will remain valid 83 // need to be ref()ed or unref()ed. The canvas will remain valid
78 // until FinishPage() or FinishDocument() is called. 84 // until FinishPage() or FinishDocument() is called.
79 SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size, 85 SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size,
80 const gfx::Rect& content_area, 86 const gfx::Rect& content_area,
81 const float& scale_factor); 87 const float& scale_factor);
82 88
83 private: 89 private:
84 std::unique_ptr<PdfMetafileSkiaData> data_; 90 std::unique_ptr<PdfMetafileSkiaData> data_;
85 91
86 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); 92 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia);
87 }; 93 };
88 94
89 } // namespace printing 95 } // namespace printing
90 96
91 #endif // PRINTING_PDF_METAFILE_SKIA_H_ 97 #endif // PRINTING_PDF_METAFILE_SKIA_H_
OLDNEW
« no previous file with comments | « no previous file | printing/pdf_metafile_skia.cc » ('j') | printing/pdf_metafile_skia.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698