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

Side by Side Diff: printing/pdf_metafile_skia.h

Issue 568633002: Extracted MetafilePlayer interface from printing::MetafilePlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_expose
Patch Set: Thu Sep 11 22:54:16 PDT 2014 Created 6 years, 3 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 | « printing/pdf_metafile_cg_mac.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "printing/metafile.h" 12 #include "printing/metafile.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 #include <windows.h> 15 #include <windows.h>
16 #endif 16 #endif
17 17
18 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
19 namespace base {
20 struct FileDescriptor;
21 }
22 #endif
23
18 namespace printing { 24 namespace printing {
19 25
20 struct PdfMetafileSkiaData; 26 struct PdfMetafileSkiaData;
21 27
22 // This class uses Skia graphics library to generate a PDF document. 28 // This class uses Skia graphics library to generate a PDF document.
23 class PRINTING_EXPORT PdfMetafileSkia : public Metafile { 29 class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
24 public: 30 public:
25 PdfMetafileSkia(); 31 PdfMetafileSkia();
26 virtual ~PdfMetafileSkia(); 32 virtual ~PdfMetafileSkia();
27 33
28 // Metafile methods. 34 // Metafile methods.
29 virtual bool Init() OVERRIDE; 35 virtual bool Init() OVERRIDE;
30 virtual bool InitFromData(const void* src_buffer, 36 virtual bool InitFromData(const void* src_buffer,
31 uint32 src_buffer_size) OVERRIDE; 37 uint32 src_buffer_size) OVERRIDE;
32 38
33 virtual SkBaseDevice* StartPageForVectorCanvas( 39 virtual SkBaseDevice* StartPageForVectorCanvas(
34 const gfx::Size& page_size, 40 const gfx::Size& page_size,
35 const gfx::Rect& content_area, 41 const gfx::Rect& content_area,
36 const float& scale_factor) OVERRIDE; 42 const float& scale_factor) OVERRIDE;
37 43
38 virtual bool StartPage(const gfx::Size& page_size, 44 virtual bool StartPage(const gfx::Size& page_size,
39 const gfx::Rect& content_area, 45 const gfx::Rect& content_area,
40 const float& scale_factor) OVERRIDE; 46 const float& scale_factor) OVERRIDE;
41 virtual bool FinishPage() OVERRIDE; 47 virtual bool FinishPage() OVERRIDE;
42 virtual bool FinishDocument() OVERRIDE; 48 virtual bool FinishDocument() OVERRIDE;
43 49
44 virtual uint32 GetDataSize() const OVERRIDE; 50 virtual uint32 GetDataSize() const OVERRIDE;
45 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const OVERRIDE; 51 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const OVERRIDE;
46 52
47 virtual bool SaveTo(const base::FilePath& file_path) const OVERRIDE;
48
49 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE; 53 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE;
50 virtual unsigned int GetPageCount() const OVERRIDE; 54 virtual unsigned int GetPageCount() const OVERRIDE;
51 55
52 virtual gfx::NativeDrawingContext context() const OVERRIDE; 56 virtual gfx::NativeDrawingContext context() const OVERRIDE;
53 57
54 #if defined(OS_WIN) 58 #if defined(OS_WIN)
55 virtual bool Playback(gfx::NativeDrawingContext hdc, 59 virtual bool Playback(gfx::NativeDrawingContext hdc,
56 const RECT* rect) const OVERRIDE; 60 const RECT* rect) const OVERRIDE;
57 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const OVERRIDE; 61 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const OVERRIDE;
58 virtual HENHMETAFILE emf() const OVERRIDE;
59 #elif defined(OS_MACOSX) 62 #elif defined(OS_MACOSX)
60 virtual bool RenderPage(unsigned int page_number, 63 virtual bool RenderPage(unsigned int page_number,
61 gfx::NativeDrawingContext context, 64 gfx::NativeDrawingContext context,
62 const CGRect rect, 65 const CGRect rect,
63 const MacRenderPageParams& params) const OVERRIDE; 66 const MacRenderPageParams& params) const OVERRIDE;
64 #endif 67 #endif
65 68
66 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 69 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
67 virtual bool SaveToFD(const base::FileDescriptor& fd) const OVERRIDE; 70 // TODO(vitalybuka): replace with SaveTo().
71 bool SaveToFD(const base::FileDescriptor& fd) const;
68 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID) 72 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID)
69 73
70 // Return a new metafile containing just the current page in draft mode. 74 // Return a new metafile containing just the current page in draft mode.
71 PdfMetafileSkia* GetMetafileForCurrentPage(); 75 scoped_ptr<PdfMetafileSkia> GetMetafileForCurrentPage();
72 76
73 private: 77 private:
74 scoped_ptr<PdfMetafileSkiaData> data_; 78 scoped_ptr<PdfMetafileSkiaData> data_;
75 79
76 // True when finish page is outstanding for current page. 80 // True when finish page is outstanding for current page.
77 bool page_outstanding_; 81 bool page_outstanding_;
78 82
79 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); 83 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia);
80 }; 84 };
81 85
82 } // namespace printing 86 } // namespace printing
83 87
84 #endif // PRINTING_PDF_METAFILE_SKIA_H_ 88 #endif // PRINTING_PDF_METAFILE_SKIA_H_
OLDNEW
« no previous file with comments | « printing/pdf_metafile_cg_mac.cc ('k') | printing/pdf_metafile_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698