| 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> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool SafePlayback(skia::NativeDrawingContext hdc) const override; | 60 bool SafePlayback(skia::NativeDrawingContext hdc) const override; |
| 61 #elif defined(OS_MACOSX) | 61 #elif defined(OS_MACOSX) |
| 62 bool RenderPage(unsigned int page_number, | 62 bool RenderPage(unsigned int page_number, |
| 63 skia::NativeDrawingContext context, | 63 skia::NativeDrawingContext context, |
| 64 const CGRect rect, | 64 const CGRect rect, |
| 65 const MacRenderPageParams& params) const override; | 65 const MacRenderPageParams& params) const override; |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 bool SaveTo(base::File* file) const override; | 68 bool SaveTo(base::File* file) const override; |
| 69 | 69 |
| 70 bool InitFromPageDataBuffer(const char* src_buffer, size_t src_buffer_size); |
| 71 |
| 70 // Return a new metafile containing just the current page in draft mode. | 72 // Return a new metafile containing just the current page in draft mode. |
| 71 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage( | 73 std::unique_ptr<PdfMetafileSkia> GetMetafileForCurrentPage( |
| 72 SkiaDocumentType type); | 74 SkiaDocumentType type); |
| 73 | 75 |
| 74 // This method calls StartPage and then returns an appropriate | 76 // This method calls StartPage and then returns an appropriate |
| 75 // PlatformCanvas implementation bound to the context created by | 77 // PlatformCanvas implementation bound to the context created by |
| 76 // StartPage or NULL on error. The SkCanvas pointer that | 78 // StartPage or NULL on error. The SkCanvas pointer that |
| 77 // is returned is owned by this PdfMetafileSkia object and does not | 79 // 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 | 80 // need to be ref()ed or unref()ed. The canvas will remain valid |
| 79 // until FinishPage() or FinishDocument() is called. | 81 // until FinishPage() or FinishDocument() is called. |
| 80 SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size, | 82 SkCanvas* GetVectorCanvasForNewPage(const gfx::Size& page_size, |
| 81 const gfx::Rect& content_area, | 83 const gfx::Rect& content_area, |
| 82 const float& scale_factor); | 84 const float& scale_factor); |
| 83 | 85 |
| 86 std::unique_ptr<char[]> GetPageDataBuffer(size_t* size) const; |
| 87 |
| 88 void ConvertPagesToPdf(); |
| 89 void FinishAllPages(); |
| 90 void GetSkp(SkWStream* stream) const; |
| 91 |
| 84 private: | 92 private: |
| 85 std::unique_ptr<PdfMetafileSkiaData> data_; | 93 std::unique_ptr<PdfMetafileSkiaData> data_; |
| 86 | 94 |
| 87 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); | 95 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 } // namespace printing | 98 } // namespace printing |
| 91 | 99 |
| 92 #endif // PRINTING_PDF_METAFILE_SKIA_H_ | 100 #endif // PRINTING_PDF_METAFILE_SKIA_H_ |
| OLD | NEW |