| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_RENDER_SETTINGS_H_ | 5 #ifndef PRINTING_PDF_RENDER_SETTINGS_H_ |
| 6 #define PRINTING_PDF_RENDER_SETTINGS_H_ | 6 #define PRINTING_PDF_RENDER_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "ipc/ipc_message_macros.h" |
| 8 #include "ipc/ipc_message_utils.h" | 11 #include "ipc/ipc_message_utils.h" |
| 9 #include "ipc/ipc_param_traits.h" | 12 #include "ipc/ipc_param_traits.h" |
| 10 #include "printing/printing_export.h" | 13 #include "printing/printing_export.h" |
| 14 #include "ui/gfx/geometry/point.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" | 16 #include "ui/gfx/ipc/geometry/gfx_param_traits.h" |
| 13 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" | 17 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" |
| 14 | 18 |
| 15 namespace printing { | 19 namespace printing { |
| 16 | 20 |
| 17 // Defining PDF rendering settings. | 21 // Defining PDF rendering settings. |
| 18 struct PdfRenderSettings { | 22 struct PdfRenderSettings { |
| 19 PdfRenderSettings() : dpi(0), autorotate(false) {} | 23 enum Mode { |
| 20 PdfRenderSettings(gfx::Rect area, int dpi, bool autorotate) | 24 NORMAL = 0, |
| 21 : area(area), dpi(dpi), autorotate(autorotate) {} | 25 #if defined(OS_WIN) |
| 26 GDI_TEXT, |
| 27 POSTSCRIPT_LEVEL2, |
| 28 POSTSCRIPT_LEVEL3, |
| 29 #endif |
| 30 }; |
| 31 |
| 32 PdfRenderSettings() : dpi(0), autorotate(false), mode(Mode::NORMAL) {} |
| 33 PdfRenderSettings(gfx::Rect area, |
| 34 gfx::Point offsets, |
| 35 int dpi, |
| 36 bool autorotate, |
| 37 Mode mode) |
| 38 : area(area), |
| 39 offsets(offsets), |
| 40 dpi(dpi), |
| 41 autorotate(autorotate), |
| 42 mode(mode) {} |
| 22 ~PdfRenderSettings() {} | 43 ~PdfRenderSettings() {} |
| 23 | 44 |
| 24 gfx::Rect area; | 45 gfx::Rect area; |
| 46 gfx::Point offsets; |
| 25 int dpi; | 47 int dpi; |
| 26 bool autorotate; | 48 bool autorotate; |
| 49 Mode mode; |
| 27 }; | 50 }; |
| 28 | 51 |
| 29 } // namespace printing | 52 } // namespace printing |
| 30 | 53 |
| 31 namespace IPC { | |
| 32 template <> | |
| 33 struct ParamTraits<printing::PdfRenderSettings> { | |
| 34 typedef printing::PdfRenderSettings param_type; | |
| 35 static void Write(base::Pickle* m, const param_type& p) { | |
| 36 WriteParam(m, p.area); | |
| 37 WriteParam(m, p.dpi); | |
| 38 WriteParam(m, p.autorotate); | |
| 39 } | |
| 40 | |
| 41 static bool Read(const base::Pickle* m, | |
| 42 base::PickleIterator* iter, | |
| 43 param_type* r) { | |
| 44 return ReadParam(m, iter, &r->area) && | |
| 45 ReadParam(m, iter, &r->dpi) && | |
| 46 ReadParam(m, iter, &r->autorotate); | |
| 47 } | |
| 48 | |
| 49 static void Log(const param_type& p, std::string* l) { | |
| 50 LogParam(p.area, l); | |
| 51 l->append(", "); | |
| 52 LogParam(p.dpi, l); | |
| 53 l->append(", "); | |
| 54 LogParam(p.autorotate, l); | |
| 55 } | |
| 56 }; | |
| 57 | |
| 58 } // namespace IPC | |
| 59 | |
| 60 #endif // PRINTING_PDF_RENDER_SETTINGS_H_ | 54 #endif // PRINTING_PDF_RENDER_SETTINGS_H_ |
| OLD | NEW |