summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 20:39:40 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-05 20:39:40 +0000
commit736441a7a4e0dde8240d5eeca984351fb0100501 (patch)
tree9782153c9640e4232df4679bb45bfbe2fb4bc50c /webkit/plugins
parente57621dc225923cf9d4bf68feb2495dd750ea652 (diff)
downloadchromium_src-736441a7a4e0dde8240d5eeca984351fb0100501.zip
chromium_src-736441a7a4e0dde8240d5eeca984351fb0100501.tar.gz
chromium_src-736441a7a4e0dde8240d5eeca984351fb0100501.tar.bz2
Pepper cleanup: USE_SKIA is always true.
We always build with skia now. This change removes dead code, and unnecessary USE_SKIA guards. BUG=110881 Review URL: https://chromiumcodereview.appspot.com/12437007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186249 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc42
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h2
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.cc51
3 files changed, 5 insertions, 90 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 4a7b8d4..b2eacb0 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);
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 92ee472..b7f7c67 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -670,7 +670,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// variable to hold on to the pixels.
scoped_refptr<PPB_ImageData_Impl> last_printed_page_;
#endif // defined(OS_MACOSX)
-#if defined(USE_SKIA)
// Always when printing to PDF on Linux and when printing for preview on Mac
// and Win, the entire document goes into one metafile. However, when users
// print only a subset of all the pages, it is impossible to know if a call
@@ -683,7 +682,6 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
SkRefPtr<WebKit::WebCanvas> canvas_;
// An array of page ranges.
std::vector<PP_PrintPageNumberRange_Dev> ranges_;
-#endif // OS_LINUX || OS_WIN
scoped_refptr< ::ppapi::Resource> gamepad_impl_;
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index 3de90b6..590a61d 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -508,56 +508,6 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
ImageDataAutoMapper auto_mapper(image_data_);
const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap();
-#if defined(OS_MACOSX) && !defined(USE_SKIA)
- SkAutoLockPixels lock(backing_bitmap);
-
- base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
- CGDataProviderCreateWithData(
- NULL, backing_bitmap.getAddr32(0, 0),
- backing_bitmap.rowBytes() * backing_bitmap.height(), NULL));
- base::mac::ScopedCFTypeRef<CGImageRef> image(
- CGImageCreate(
- backing_bitmap.width(), backing_bitmap.height(),
- 8, 32, backing_bitmap.rowBytes(),
- base::mac::GetSystemColorSpace(),
- kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
- data_provider, NULL, false, kCGRenderingIntentDefault));
-
- // Flip the transform
- gfx::ScopedCGContextSaveGState save_gstate(canvas)
- float window_height = static_cast<float>(CGBitmapContextGetHeight(canvas));
- CGContextTranslateCTM(canvas, 0, window_height);
- CGContextScaleCTM(canvas, 1.0, -1.0);
-
- // To avoid painting outside the plugin boundaries and clip instead of
- // scaling, CGContextDrawImage() must draw the full image using |bitmap_rect|
- // but the context must be clipped to the plugin using |bounds|.
-
- CGRect bitmap_rect;
- bitmap_rect.origin.x = plugin_rect.origin().x();
- bitmap_rect.origin.y = window_height - plugin_rect.origin().y() -
- backing_bitmap.height();
- bitmap_rect.size.width = backing_bitmap.width();
- bitmap_rect.size.height = backing_bitmap.height();
-
- CGRect bounds;
- bounds.origin.x = plugin_rect.origin().x();
- bounds.origin.y = window_height - plugin_rect.origin().y() -
- plugin_rect.height();
- bounds.size.width = plugin_rect.width();
- bounds.size.height = plugin_rect.height();
- // TODO(yzshen): We should take |paint_rect| into consideration as well.
- CGContextClipToRect(canvas, bounds);
-
- // TODO(jhorwich) Figure out if this code is even active anymore, and if so
- // how to properly handle scaling.
- DCHECK_EQ(1.0f, scale_);
-
- // TODO(brettw) bug 56673: do a direct memcpy instead of going through CG
- // if the is_always_opaque_ flag is set. Must ensure bitmap is still clipped.
-
- CGContextDrawImage(canvas, bitmap_rect, image);
-#else
gfx::Rect invalidate_rect = gfx::IntersectRects(plugin_rect, paint_rect);
SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect);
SkAutoCanvasRestore auto_restore(canvas, true);
@@ -612,7 +562,6 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
canvas->scale(scale_, scale_);
}
canvas->drawBitmap(image, pixel_origin.x(), pixel_origin.y(), &paint);
-#endif
}
void PPB_Graphics2D_Impl::ViewWillInitiatePaint() {