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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 8231030: PrintPreview: [Win] Added a temporary hack to print blank pdf pages. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 9824c67ebd6fc468ea3858b97a80e0fe00836e2b..16ad6fb4103ab0c2de92694da7f634934cc78a1f 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -130,6 +130,16 @@ typedef bool (*RenderPDFPageToDCProc)(
int bounds_width, int bounds_height, bool fit_to_bounds,
bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds,
bool autorotate);
+
+void DrawEmptyRectangle(HDC dc) {
+ // TODO(sanjeevr): This is a temporary hack. If we output a JPEG
+ // to the EMF, the EnumEnhMetaFile call fails in the browser
+ // process. The failure also happens if we output nothing here.
+ // We need to investigate the reason for this failure and fix it.
+ // In the meantime this temporary hack of drawing an empty
+ // rectangle in the DC gets us by.
+ Rectangle(dc, 0, 0, 0, 0);
+}
#endif // defined(OS_WIN)
namespace {
@@ -1162,6 +1172,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
// On Windows, we now need to render the PDF to the DC that backs the
// supplied canvas.
HDC dc = skia::BeginPlatformPaint(canvas);
+ DrawEmptyRectangle(dc);
gfx::Size size_in_pixels;
size_in_pixels.set_width(printing::ConvertUnit(
current_print_settings_.printable_area.size.width,
@@ -1281,13 +1292,7 @@ bool PluginInstance::DrawJPEGToPlatformDC(
skia::ScopedPlatformPaint scoped_platform_paint(canvas);
HDC dc = scoped_platform_paint.GetPlatformSurface();
- // TODO(sanjeevr): This is a temporary hack. If we output a JPEG
- // to the EMF, the EnumEnhMetaFile call fails in the browser
- // process. The failure also happens if we output nothing here.
- // We need to investigate the reason for this failure and fix it.
- // In the meantime this temporary hack of drawing an empty
- // rectangle in the DC gets us by.
- Rectangle(dc, 0, 0, 0, 0);
+ DrawEmptyRectangle(dc);
BITMAPINFOHEADER bmi = {0};
gfx::CreateBitmapHeader(bitmap.width(), bitmap.height(), &bmi);
bmi.biCompression = BI_JPEG;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698