Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 8146004: Added autorotate flag in PDF rendering and wiring it through service-utility channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/pdf_render_settings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « printing/pdf_render_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698