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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 namespace webkit { | 120 namespace webkit { |
121 namespace ppapi { | 121 namespace ppapi { |
122 | 122 |
123 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
124 // Exported by pdf.dll | 124 // Exported by pdf.dll |
125 typedef bool (*RenderPDFPageToDCProc)( | 125 typedef bool (*RenderPDFPageToDCProc)( |
126 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, | 126 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, |
127 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, | 127 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, |
128 int bounds_width, int bounds_height, bool fit_to_bounds, | 128 int bounds_width, int bounds_height, bool fit_to_bounds, |
129 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds); | 129 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds, |
| 130 bool autorotate); |
130 #endif // defined(OS_WIN) | 131 #endif // defined(OS_WIN) |
131 | 132 |
132 namespace { | 133 namespace { |
133 | 134 |
134 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \ | 135 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \ |
135 COMPILE_ASSERT(static_cast<int>(WebCursorInfo::webkit_name) \ | 136 COMPILE_ASSERT(static_cast<int>(WebCursorInfo::webkit_name) \ |
136 == static_cast<int>(np_name), \ | 137 == static_cast<int>(np_name), \ |
137 mismatching_enums) | 138 mismatching_enums) |
138 | 139 |
139 COMPILE_ASSERT_MATCHING_ENUM(TypePointer, PP_CURSORTYPE_POINTER); | 140 COMPILE_ASSERT_MATCHING_ENUM(TypePointer, PP_CURSORTYPE_POINTER); |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 // set of pixels leads to a blurry output). However, we need to counter the | 1152 // set of pixels leads to a blurry output). However, we need to counter the |
1152 // scaling up that will happen in the browser. | 1153 // scaling up that will happen in the browser. |
1153 XFORM xform = {0}; | 1154 XFORM xform = {0}; |
1154 xform.eM11 = xform.eM22 = static_cast<float>(printing::kPointsPerInch) / | 1155 xform.eM11 = xform.eM22 = static_cast<float>(printing::kPointsPerInch) / |
1155 static_cast<float>(current_print_settings_.dpi); | 1156 static_cast<float>(current_print_settings_.dpi); |
1156 ModifyWorldTransform(dc, &xform, MWT_LEFTMULTIPLY); | 1157 ModifyWorldTransform(dc, &xform, MWT_LEFTMULTIPLY); |
1157 | 1158 |
1158 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(), | 1159 ret = render_proc(static_cast<unsigned char*>(mapper.data()), mapper.size(), |
1159 0, dc, current_print_settings_.dpi, | 1160 0, dc, current_print_settings_.dpi, |
1160 current_print_settings_.dpi, 0, 0, size_in_pixels.width(), | 1161 current_print_settings_.dpi, 0, 0, size_in_pixels.width(), |
1161 size_in_pixels.height(), true, false, true, true); | 1162 size_in_pixels.height(), true, false, true, true, true); |
1162 skia::EndPlatformPaint(canvas); | 1163 skia::EndPlatformPaint(canvas); |
1163 } | 1164 } |
1164 #endif // defined(OS_WIN) | 1165 #endif // defined(OS_WIN) |
1165 | 1166 |
1166 return ret; | 1167 return ret; |
1167 } | 1168 } |
1168 | 1169 |
1169 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, | 1170 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, |
1170 WebKit::WebCanvas* canvas) { | 1171 WebKit::WebCanvas* canvas) { |
1171 EnterResourceNoLock<PPB_ImageData_API> enter(print_output, true); | 1172 EnterResourceNoLock<PPB_ImageData_API> enter(print_output, true); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 } | 1716 } |
1716 WebKit::WebDocument main_document = | 1717 WebKit::WebDocument main_document = |
1717 containing_document.frame()->view()->mainFrame()->document(); | 1718 containing_document.frame()->view()->mainFrame()->document(); |
1718 | 1719 |
1719 return containing_document.securityOrigin().canAccess( | 1720 return containing_document.securityOrigin().canAccess( |
1720 main_document.securityOrigin()); | 1721 main_document.securityOrigin()); |
1721 } | 1722 } |
1722 | 1723 |
1723 } // namespace ppapi | 1724 } // namespace ppapi |
1724 } // namespace webkit | 1725 } // namespace webkit |
OLD | NEW |