summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:52:16 +0000
committerpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 19:52:16 +0000
commit753efc479384c254e263fd11390846a060fa6ce0 (patch)
tree488097f0622c5d744059f3c2ada4894b683c5305 /chrome/plugin
parent5e4d24d67febed160e2020f5c8f13d8073921fc4 (diff)
downloadchromium_src-753efc479384c254e263fd11390846a060fa6ce0.zip
chromium_src-753efc479384c254e263fd11390846a060fa6ce0.tar.gz
chromium_src-753efc479384c254e263fd11390846a060fa6ce0.tar.bz2
BSD ifdefs, etc. necessary for chrome/
Review URL: http://codereview.chromium.org/656009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_main.cc2
-rw-r--r--chrome/plugin/webplugin_proxy.cc68
-rw-r--r--chrome/plugin/webplugin_proxy.h2
3 files changed, 36 insertions, 36 deletions
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index 06c05b1..070cfd5 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -23,7 +23,7 @@
#if defined(OS_WIN)
#include "chrome/test/injection_test_dll.h"
#include "sandbox/src/sandbox.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/global_descriptors_posix.h"
#include "ipc/ipc_descriptors.h"
#endif
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 6326065..ffda5c1 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -75,7 +75,7 @@ void WebPluginProxy::WillDestroyWindow(gfx::PluginWindowHandle window) {
PluginThread::current()->Send(
new PluginProcessHostMsg_PluginWindowDestroyed(
window, ::GetParent(window)));
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
// Nothing to do.
#else
NOTIMPLEMENTED();
@@ -343,19 +343,46 @@ bool WebPluginProxy::SetDropEffect(struct NPObject* event, int effect) {
}
void WebPluginProxy::Paint(const gfx::Rect& rect) {
-#if defined(OS_WIN) || defined(OS_LINUX)
- if (!windowless_canvas_.get())
- return;
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
if (!windowless_context_.get())
return;
+#else
+ if (!windowless_canvas_.get())
+ return;
#endif
// Clear the damaged area so that if the plugin doesn't paint there we won't
// end up with the old values.
gfx::Rect offset_rect = rect;
offset_rect.Offset(delegate_->GetRect().origin());
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_MACOSX)
+ CGContextSaveGState(windowless_context_);
+ // It is possible for windowless_context_ to change during plugin painting
+ // (since the plugin can make a synchronous call during paint event handling),
+ // in which case we don't want to try to restore it later. Not an owning ref
+ // since owning the ref without owning the shared backing memory doesn't make
+ // sense, so this should only be used for pointer comparisons.
+ CGContextRef saved_context_weak = windowless_context_.get();
+
+ if (!background_context_.get()) {
+ CGContextSetFillColorWithColor(windowless_context_,
+ CGColorGetConstantColor(kCGColorBlack));
+ CGContextFillRect(windowless_context_, rect.ToCGRect());
+ } else {
+ scoped_cftyperef<CGImageRef> image(
+ CGBitmapContextCreateImage(background_context_));
+ CGRect source_rect = rect.ToCGRect();
+ // Flip the rect we use to pull from the canvas, since it's upside-down.
+ source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height();
+ scoped_cftyperef<CGImageRef> sub_image(
+ CGImageCreateWithImageInRect(image, source_rect));
+ CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
+ }
+ CGContextClipToRect(windowless_context_, rect.ToCGRect());
+ delegate_->Paint(windowless_context_, rect);
+ if (windowless_context_.get() == saved_context_weak)
+ CGContextRestoreGState(windowless_context_);
+#else
windowless_canvas_->save();
// The given clip rect is relative to the plugin coordinate system.
@@ -393,33 +420,6 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
delegate_->Paint(windowless_canvas_.get(), offset_rect);
windowless_canvas_->restore();
-#elif defined(OS_MACOSX)
- CGContextSaveGState(windowless_context_);
- // It is possible for windowless_context_ to change during plugin painting
- // (since the plugin can make a synchronous call during paint event handling),
- // in which case we don't want to try to restore it later. Not an owning ref
- // since owning the ref without owning the shared backing memory doesn't make
- // sense, so this should only be used for pointer comparisons.
- CGContextRef saved_context_weak = windowless_context_.get();
-
- if (!background_context_.get()) {
- CGContextSetFillColorWithColor(windowless_context_,
- CGColorGetConstantColor(kCGColorBlack));
- CGContextFillRect(windowless_context_, rect.ToCGRect());
- } else {
- scoped_cftyperef<CGImageRef> image(
- CGBitmapContextCreateImage(background_context_));
- CGRect source_rect = rect.ToCGRect();
- // Flip the rect we use to pull from the canvas, since it's upside-down.
- source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height();
- scoped_cftyperef<CGImageRef> sub_image(
- CGImageCreateWithImageInRect(image, source_rect));
- CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
- }
- CGContextClipToRect(windowless_context_, rect.ToCGRect());
- delegate_->Paint(windowless_context_, rect);
- if (windowless_context_.get() == saved_context_weak)
- CGContextRestoreGState(windowless_context_);
#endif
}
@@ -535,7 +535,7 @@ void WebPluginProxy::SetWindowlessBuffer(
}
}
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
void WebPluginProxy::SetWindowlessBuffer(
const TransportDIB::Handle& windowless_buffer,
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 16a6593..0beb9cb 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -170,7 +170,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
scoped_ptr<skia::PlatformCanvas> windowless_canvas_;
scoped_ptr<skia::PlatformCanvas> background_canvas_;
-#if defined(OS_LINUX)
+#if defined(USE_X11)
scoped_ptr<TransportDIB> windowless_dib_;
scoped_ptr<TransportDIB> background_dib_;
#endif