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

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

Issue 12437007: Pepper cleanup: USE_SKIA is always true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | 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 4a7b8d4c18ffbbd4e66d1aa99cc5bb6937a21111..b2eacb0313e385b52bf1b0515f75a03f2aaa7c0b 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -43,7 +43,10 @@
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_buffer_api.h"
+#include "printing/metafile.h"
+#include "printing/metafile_skia_wrapper.h"
#include "printing/units.h"
+#include "skia/ext/platform_device.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebGamepads.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
@@ -88,18 +91,8 @@
#if defined(OS_MACOSX)
#include "printing/metafile_impl.h"
-#if !defined(USE_SKIA)
-#include "base/mac/mac_util.h"
-#include "base/mac/scoped_cftyperef.h"
-#endif // !defined(USE_SKIA)
#endif // defined(OS_MACOSX)
-#if defined(USE_SKIA)
-#include "printing/metafile.h"
-#include "printing/metafile_skia_wrapper.h"
-#include "skia/ext/platform_device.h"
-#endif
-
#if defined(OS_WIN)
#include "base/metrics/histogram.h"
#include "base/win/windows_version.h"
@@ -1320,10 +1313,8 @@ int PluginInstance::PrintBegin(const WebPrintParams& print_params) {
if (!num_pages)
return 0;
current_print_settings_ = print_settings;
-#if defined(USE_SKIA)
canvas_ = NULL;
ranges_.clear();
-#endif // USE_SKIA
return num_pages;
}
@@ -1332,7 +1323,6 @@ bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
DCHECK(plugin_print_interface_);
PP_PrintPageNumberRange_Dev page_range;
page_range.first_page_number = page_range.last_page_number = page_number;
-#if defined(USE_SKIA)
// The canvas only has a metafile on it for print preview.
bool save_for_later =
(printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL);
@@ -1343,9 +1333,7 @@ bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
ranges_.push_back(page_range);
canvas_ = canvas;
return true;
- } else
-#endif // USE_SKIA
- {
+ } else {
return PrintPageHelper(&page_range, 1, canvas);
}
#else // defined(ENABLED_PRINTING)
@@ -1380,12 +1368,10 @@ bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
void PluginInstance::PrintEnd() {
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PluginInstance> ref(this);
-#if defined(USE_SKIA)
if (!ranges_.empty())
PrintPageHelper(&(ranges_.front()), ranges_.size(), canvas_.get());
canvas_ = NULL;
ranges_.clear();
-#endif // USE_SKIA
DCHECK(plugin_print_interface_);
if (plugin_print_interface_)
@@ -1637,7 +1623,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
#endif // defined(OS_WIN)
bool ret = false;
-#if defined(OS_LINUX) || (defined(OS_MACOSX) && defined(USE_SKIA))
+#if defined(OS_LINUX) || defined(OS_MACOSX)
// On Linux we just set the final bits in the native metafile
// (NativeMetafile and PreviewMetafile must have compatible formats,
// i.e. both PDF for this to work).
@@ -1646,24 +1632,6 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
DCHECK(metafile != NULL);
if (metafile)
ret = metafile->InitFromData(mapper.data(), mapper.size());
-#elif defined(OS_MACOSX)
- printing::NativeMetafile metafile;
- // Create a PDF metafile and render from there into the passed in context.
- if (metafile.InitFromData(mapper.data(), mapper.size())) {
- // Flip the transform.
- CGContextRef cgContext = canvas;
- gfx::ScopedCGContextSaveGState save_gstate(cgContext)
- CGContextTranslateCTM(cgContext, 0,
- current_print_settings_.printable_area.size.height);
- CGContextScaleCTM(cgContext, 1.0, -1.0);
- CGRect page_rect;
- page_rect.origin.x = current_print_settings_.printable_area.point.x;
- page_rect.origin.y = current_print_settings_.printable_area.point.y;
- 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, cgContext, page_rect, true, false, true, true);
- }
#elif defined(OS_WIN)
printing::Metafile* metafile =
printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas);
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698