| 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 "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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 struct PdfMetafileSkiaData; | 26 struct PdfMetafileSkiaData; |
| 27 | 27 |
| 28 // This class uses Skia graphics library to generate a PDF document. | 28 // This class uses Skia graphics library to generate a PDF document. |
| 29 class PRINTING_EXPORT PdfMetafileSkia : public Metafile { | 29 class PRINTING_EXPORT PdfMetafileSkia : public Metafile { |
| 30 public: | 30 public: |
| 31 PdfMetafileSkia(); | 31 PdfMetafileSkia(); |
| 32 virtual ~PdfMetafileSkia(); | 32 virtual ~PdfMetafileSkia(); |
| 33 | 33 |
| 34 // Metafile methods. | 34 // Metafile methods. |
| 35 virtual bool Init() OVERRIDE; | 35 virtual bool Init() override; |
| 36 virtual bool InitFromData(const void* src_buffer, | 36 virtual bool InitFromData(const void* src_buffer, |
| 37 uint32 src_buffer_size) OVERRIDE; | 37 uint32 src_buffer_size) override; |
| 38 | 38 |
| 39 virtual SkBaseDevice* StartPageForVectorCanvas( | 39 virtual SkBaseDevice* StartPageForVectorCanvas( |
| 40 const gfx::Size& page_size, | 40 const gfx::Size& page_size, |
| 41 const gfx::Rect& content_area, | 41 const gfx::Rect& content_area, |
| 42 const float& scale_factor) OVERRIDE; | 42 const float& scale_factor) override; |
| 43 | 43 |
| 44 virtual bool StartPage(const gfx::Size& page_size, | 44 virtual bool StartPage(const gfx::Size& page_size, |
| 45 const gfx::Rect& content_area, | 45 const gfx::Rect& content_area, |
| 46 const float& scale_factor) OVERRIDE; | 46 const float& scale_factor) override; |
| 47 virtual bool FinishPage() OVERRIDE; | 47 virtual bool FinishPage() override; |
| 48 virtual bool FinishDocument() OVERRIDE; | 48 virtual bool FinishDocument() override; |
| 49 | 49 |
| 50 virtual uint32 GetDataSize() const OVERRIDE; | 50 virtual uint32 GetDataSize() const override; |
| 51 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; |
| 52 | 52 |
| 53 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE; | 53 virtual gfx::Rect GetPageBounds(unsigned int page_number) const override; |
| 54 virtual unsigned int GetPageCount() const OVERRIDE; | 54 virtual unsigned int GetPageCount() const override; |
| 55 | 55 |
| 56 virtual gfx::NativeDrawingContext context() const OVERRIDE; | 56 virtual gfx::NativeDrawingContext context() const override; |
| 57 | 57 |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 virtual bool Playback(gfx::NativeDrawingContext hdc, | 59 virtual bool Playback(gfx::NativeDrawingContext hdc, |
| 60 const RECT* rect) const OVERRIDE; | 60 const RECT* rect) const override; |
| 61 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const OVERRIDE; | 61 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const override; |
| 62 #elif defined(OS_MACOSX) | 62 #elif defined(OS_MACOSX) |
| 63 virtual bool RenderPage(unsigned int page_number, | 63 virtual bool RenderPage(unsigned int page_number, |
| 64 gfx::NativeDrawingContext context, | 64 gfx::NativeDrawingContext context, |
| 65 const CGRect rect, | 65 const CGRect rect, |
| 66 const MacRenderPageParams& params) const OVERRIDE; | 66 const MacRenderPageParams& params) const override; |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 69 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 70 // TODO(vitalybuka): replace with SaveTo(). | 70 // TODO(vitalybuka): replace with SaveTo(). |
| 71 bool SaveToFD(const base::FileDescriptor& fd) const; | 71 bool SaveToFD(const base::FileDescriptor& fd) const; |
| 72 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 72 #endif // if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
| 73 | 73 |
| 74 // 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. |
| 75 scoped_ptr<PdfMetafileSkia> GetMetafileForCurrentPage(); | 75 scoped_ptr<PdfMetafileSkia> GetMetafileForCurrentPage(); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 scoped_ptr<PdfMetafileSkiaData> data_; | 78 scoped_ptr<PdfMetafileSkiaData> data_; |
| 79 | 79 |
| 80 // True when finish page is outstanding for current page. | 80 // True when finish page is outstanding for current page. |
| 81 bool page_outstanding_; | 81 bool page_outstanding_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); | 83 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace printing | 86 } // namespace printing |
| 87 | 87 |
| 88 #endif // PRINTING_PDF_METAFILE_SKIA_H_ | 88 #endif // PRINTING_PDF_METAFILE_SKIA_H_ |
| OLD | NEW |