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

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

Issue 6696076: Adding CreateFromData to NativeMetafileFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 9 years, 9 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
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/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 // On Linux we need to get the backing PdfPsMetafile and write the bits 1183 // On Linux we need to get the backing PdfPsMetafile and write the bits
1184 // directly. 1184 // directly.
1185 cairo_t* context = canvas->beginPlatformPaint(); 1185 cairo_t* context = canvas->beginPlatformPaint();
1186 printing::NativeMetafile* metafile = 1186 printing::NativeMetafile* metafile =
1187 printing::PdfPsMetafile::FromCairoContext(context); 1187 printing::PdfPsMetafile::FromCairoContext(context);
1188 DCHECK(metafile); 1188 DCHECK(metafile);
1189 if (metafile) 1189 if (metafile)
1190 ret = metafile->InitFromData(buffer->mapped_buffer(), buffer->size()); 1190 ret = metafile->InitFromData(buffer->mapped_buffer(), buffer->size());
1191 canvas->endPlatformPaint(); 1191 canvas->endPlatformPaint();
1192 #elif defined(OS_MACOSX) 1192 #elif defined(OS_MACOSX)
1193 // Create a PDF metafile and render from there into the passed in context.
1193 scoped_ptr<printing::NativeMetafile> metafile( 1194 scoped_ptr<printing::NativeMetafile> metafile(
1194 printing::NativeMetafileFactory::Create()); 1195 printing::NativeMetafileFactory::CreateFromData(buffer->mapped_buffer(),
1195 // Create a PDF metafile and render from there into the passed in context. 1196 buffer->size()));
1196 if (metafile->InitFromData(buffer->mapped_buffer(), buffer->size())) { 1197 if (metafile.get() != NULL) {
1197 // Flip the transform. 1198 // Flip the transform.
1198 CGContextSaveGState(canvas); 1199 CGContextSaveGState(canvas);
1199 CGContextTranslateCTM(canvas, 0, 1200 CGContextTranslateCTM(canvas, 0,
1200 current_print_settings_.printable_area.size.height); 1201 current_print_settings_.printable_area.size.height);
1201 CGContextScaleCTM(canvas, 1.0, -1.0); 1202 CGContextScaleCTM(canvas, 1.0, -1.0);
1202 CGRect page_rect; 1203 CGRect page_rect;
1203 page_rect.origin.x = current_print_settings_.printable_area.point.x; 1204 page_rect.origin.x = current_print_settings_.printable_area.point.x;
1204 page_rect.origin.y = current_print_settings_.printable_area.point.y; 1205 page_rect.origin.y = current_print_settings_.printable_area.point.y;
1205 page_rect.size.width = current_print_settings_.printable_area.size.width; 1206 page_rect.size.width = current_print_settings_.printable_area.size.width;
1206 page_rect.size.height = current_print_settings_.printable_area.size.height; 1207 page_rect.size.height = current_print_settings_.printable_area.size.height;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 return found->second; 1453 return found->second;
1453 } 1454 }
1454 1455
1455 bool PluginInstance::IsFullPagePlugin() const { 1456 bool PluginInstance::IsFullPagePlugin() const {
1456 WebFrame* frame = container()->element().document().frame(); 1457 WebFrame* frame = container()->element().document().frame();
1457 return frame->view()->mainFrame()->document().isPluginDocument(); 1458 return frame->view()->mainFrame()->document().isPluginDocument();
1458 } 1459 }
1459 1460
1460 } // namespace ppapi 1461 } // namespace ppapi
1461 } // namespace webkit 1462 } // namespace webkit
OLDNEW
« printing/native_metafile_factory.cc ('K') | « printing/native_metafile_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698