Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PRINTING_PDF_METAFILE_SKIA_H_ | |
| 6 #define PRINTING_PDF_METAFILE_SKIA_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/logging.h" | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "build/build_config.h" | |
| 12 #include "printing/native_metafile.h" | |
| 13 | |
| 14 #if defined(OS_WIN) | |
| 15 #include <windows.h> | |
| 16 #include <vector> | |
|
Lei Zhang
2011/04/07 17:48:57
nit: no need for vector.
vandebo (ex-Chrome)
2011/04/07 23:05:39
Done.
| |
| 17 #endif | |
| 18 | |
| 19 namespace printing { | |
| 20 | |
| 21 struct PdfMetafileSkiaData; | |
| 22 | |
| 23 // This class uses Skia graphics library to generate a PDF document. | |
| 24 class PdfMetafileSkia : public NativeMetafile { | |
| 25 public: | |
| 26 virtual ~PdfMetafileSkia(); | |
| 27 | |
| 28 // NativeMetafile interface | |
| 29 virtual bool Init(); | |
| 30 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size); | |
| 31 | |
| 32 virtual skia::PlatformDevice* StartPageForVectorCanvas( | |
| 33 const gfx::Size& page_size, | |
| 34 const gfx::Point& content_origin, | |
| 35 const float& scale_factor); | |
| 36 virtual bool StartPage(const gfx::Size& page_size, | |
| 37 const gfx::Point& content_origin, | |
| 38 const float& scale_factor); | |
| 39 virtual bool FinishPage(); | |
| 40 virtual bool FinishDocument(); | |
| 41 | |
| 42 virtual uint32 GetDataSize() const; | |
| 43 virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const; | |
| 44 | |
| 45 virtual bool SaveTo(const FilePath& file_path) const; | |
| 46 | |
| 47 virtual gfx::Rect GetPageBounds(unsigned int page_number) const; | |
| 48 virtual unsigned int GetPageCount() const; | |
| 49 | |
| 50 virtual gfx::NativeDrawingContext context() const; | |
| 51 | |
| 52 #if defined(OS_WIN) | |
| 53 virtual bool Playback(gfx::NativeDrawingContext hdc, const RECT* rect) const; | |
| 54 virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const; | |
| 55 virtual HENHMETAFILE emf() const; | |
| 56 #endif // if defined(OS_WIN) | |
| 57 | |
| 58 #if defined(OS_CHROMEOS) | |
| 59 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | |
| 60 #endif // if defined(OS_CHROMEOS) | |
| 61 | |
| 62 protected: | |
| 63 PdfMetafileSkia(); | |
| 64 | |
| 65 private: | |
| 66 friend class NativeMetafileFactory; | |
| 67 | |
| 68 scoped_ptr<PdfMetafileSkiaData> data_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(PdfMetafileSkia); | |
| 71 }; | |
| 72 | |
| 73 } // namespace printing | |
| 74 | |
| 75 #endif // PRINTING_PDF_METAFILE_MAC_H_ | |
| OLD | NEW |