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

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

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for Mac Created 9 years, 10 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
« printing/printing_context_cairo.cc ('K') | « printing/printing_context_cairo.cc ('k') | 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 421d6763721a04dfb34ebe34528d6bfb9e56be17..2f0d74a06ba17a7c0b573d300ee461fd2085dbed 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,6 +23,10 @@
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/ppp_instance.h"
#include "printing/native_metafile.h"
+#include "printing/native_metafile_factory.h"
+#if defined(OS_LINUX)
vandebo (ex-Chrome) 2011/02/24 22:42:50 per platform includes generally go at the end.
dpapad 2011/02/26 01:42:29 Done.
+#include "printing/pdf_ps_metafile_cairo.h"
+#endif
#include "printing/units.h"
#include "skia/ext/vector_platform_device.h"
#include "skia/ext/platform_canvas.h"
@@ -1028,15 +1032,16 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
// directly.
cairo_t* context = canvas->beginPlatformPaint();
printing::NativeMetafile* metafile =
- printing::NativeMetafile::FromCairoContext(context);
+ printing::PdfPsMetafile::FromCairoContext(context);
DCHECK(metafile);
if (metafile)
ret = metafile->SetRawData(buffer->mapped_buffer(), buffer->size());
canvas->endPlatformPaint();
#elif defined(OS_MACOSX)
- printing::NativeMetafile metafile;
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::NativeMetafileFactory::CreateMetafile());
// Create a PDF metafile and render from there into the passed in context.
- if (metafile.Init(buffer->mapped_buffer(), buffer->size())) {
+ if (metafile->Init(buffer->mapped_buffer(), buffer->size())) {
// Flip the transform.
CGContextSaveGState(canvas);
CGContextTranslateCTM(canvas, 0,
@@ -1048,7 +1053,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
page_rect.size.width = current_print_settings_.printable_area.size.width;
page_rect.size.height = current_print_settings_.printable_area.size.height;
- ret = metafile.RenderPage(1, canvas, page_rect, true, false, true, true);
+ ret = metafile->RenderPage(1, canvas, page_rect, true, false, true, true);
CGContextRestoreGState(canvas);
}
#elif defined(OS_WIN)
« printing/printing_context_cairo.cc ('K') | « printing/printing_context_cairo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698