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

Unified Diff: chrome/renderer/webplugin_delegate_pepper.cc

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed NativeMetafileFactory class comments 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
Index: chrome/renderer/webplugin_delegate_pepper.cc
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 921138f5f633f625fc9ca0fcfa83bb8b30f90185..7ca7f8d73fdf8721a468b1daa0971718764cf6e7 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -51,6 +51,7 @@
#include "ui/gfx/gdi_util.h"
#endif
#include "printing/native_metafile.h"
+#include "printing/native_metafile_factory.h"
#include "third_party/npapi/bindings/npapi_extensions.h"
#include "third_party/npapi/bindings/npapi_extensions_private.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
@@ -1221,24 +1222,25 @@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
// On Linux we need to get the backing PdfPsMetafile and write the bits
// directly.
cairo_t* context = canvas->beginPlatformPaint();
- printing::NativeMetafile* metafile =
- printing::NativeMetafile::FromCairoContext(context);
- DCHECK(metafile);
- if (metafile) {
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::NativeMetafileFactory::CreateMetafileFrom(context));
vandebo (ex-Chrome) 2011/02/23 02:01:41 indention.
dpapad 2011/02/24 20:56:59 Done.
+ DCHECK(metafile.get());
+ if (metafile.get()) {
ret = metafile->SetRawData(pdf_output, output_size);
if (ret)
pdf_output_done_ = true;
}
canvas->endPlatformPaint();
#elif defined(OS_MACOSX)
- printing::NativeMetafile metafile;
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::MetafileFactory::GetMetafile());
// Create a PDF metafile and render from there into the passed in context.
- if (metafile.Init(pdf_output, output_size)) {
+ if (metafile->Init(pdf_output, output_size)) {
// Flip the transform.
CGContextSaveGState(canvas);
CGContextTranslateCTM(canvas, 0, current_printable_area_.height());
CGContextScaleCTM(canvas, 1.0, -1.0);
- ret = metafile.RenderPage(1, canvas, current_printable_area_.ToCGRect(),
+ ret = metafile->RenderPage(1, canvas, current_printable_area_.ToCGRect(),
true, false, true, true);
CGContextRestoreGState(canvas);
}

Powered by Google App Engine
This is Rietveld 408576698