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

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
« no previous file with comments | « printing/native_metafile_factory.cc ('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/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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1180
1181 bool ret = false; 1181 bool ret = false;
1182 #if defined(OS_LINUX) 1182 #if defined(OS_LINUX)
1183 // On Linux we just set the final bits in the native metafile. 1183 // On Linux we just set the final bits in the native metafile.
1184 printing::NativeMetafile* metafile = 1184 printing::NativeMetafile* metafile =
1185 printing::NativeMetafileSkiaWrapper::GetMetafileFromCanvas(canvas); 1185 printing::NativeMetafileSkiaWrapper::GetMetafileFromCanvas(canvas);
1186 DCHECK(metafile != NULL); 1186 DCHECK(metafile != NULL);
1187 if (metafile) 1187 if (metafile)
1188 ret = metafile->InitFromData(buffer->mapped_buffer(), buffer->size()); 1188 ret = metafile->InitFromData(buffer->mapped_buffer(), buffer->size());
1189 #elif defined(OS_MACOSX) 1189 #elif defined(OS_MACOSX)
1190 // Create a PDF metafile and render from there into the passed in context.
1190 scoped_ptr<printing::NativeMetafile> metafile( 1191 scoped_ptr<printing::NativeMetafile> metafile(
1191 printing::NativeMetafileFactory::Create()); 1192 printing::NativeMetafileFactory::CreateFromData(buffer->mapped_buffer(),
1192 // Create a PDF metafile and render from there into the passed in context. 1193 buffer->size()));
1193 if (metafile->InitFromData(buffer->mapped_buffer(), buffer->size())) { 1194 if (metafile.get() != NULL) {
1194 // Flip the transform. 1195 // Flip the transform.
1195 CGContextSaveGState(canvas); 1196 CGContextSaveGState(canvas);
1196 CGContextTranslateCTM(canvas, 0, 1197 CGContextTranslateCTM(canvas, 0,
1197 current_print_settings_.printable_area.size.height); 1198 current_print_settings_.printable_area.size.height);
1198 CGContextScaleCTM(canvas, 1.0, -1.0); 1199 CGContextScaleCTM(canvas, 1.0, -1.0);
1199 CGRect page_rect; 1200 CGRect page_rect;
1200 page_rect.origin.x = current_print_settings_.printable_area.point.x; 1201 page_rect.origin.x = current_print_settings_.printable_area.point.x;
1201 page_rect.origin.y = current_print_settings_.printable_area.point.y; 1202 page_rect.origin.y = current_print_settings_.printable_area.point.y;
1202 page_rect.size.width = current_print_settings_.printable_area.size.width; 1203 page_rect.size.width = current_print_settings_.printable_area.size.width;
1203 page_rect.size.height = current_print_settings_.printable_area.size.height; 1204 page_rect.size.height = current_print_settings_.printable_area.size.height;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 return found->second; 1450 return found->second;
1450 } 1451 }
1451 1452
1452 bool PluginInstance::IsFullPagePlugin() const { 1453 bool PluginInstance::IsFullPagePlugin() const {
1453 WebFrame* frame = container()->element().document().frame(); 1454 WebFrame* frame = container()->element().document().frame();
1454 return frame->view()->mainFrame()->document().isPluginDocument(); 1455 return frame->view()->mainFrame()->document().isPluginDocument();
1455 } 1456 }
1456 1457
1457 } // namespace ppapi 1458 } // namespace ppapi
1458 } // namespace webkit 1459 } // namespace webkit
OLDNEW
« no previous file with comments | « printing/native_metafile_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698