| OLD | NEW |
| 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 "content/plugin/webplugin_proxy.h" | 5 #include "content/plugin/webplugin_proxy.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 CGRect source_rect = rect.ToCGRect(); | 343 CGRect source_rect = rect.ToCGRect(); |
| 344 // Flip the rect we use to pull from the canvas, since it's upside-down. | 344 // Flip the rect we use to pull from the canvas, since it's upside-down. |
| 345 source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height(); | 345 source_rect.origin.y = CGImageGetHeight(image) - rect.y() - rect.height(); |
| 346 base::mac::ScopedCFTypeRef<CGImageRef> sub_image( | 346 base::mac::ScopedCFTypeRef<CGImageRef> sub_image( |
| 347 CGImageCreateWithImageInRect(image, source_rect)); | 347 CGImageCreateWithImageInRect(image, source_rect)); |
| 348 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image); | 348 CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image); |
| 349 } else if (transparent_) { | 349 } else if (transparent_) { |
| 350 CGContextClearRect(windowless_context_, rect.ToCGRect()); | 350 CGContextClearRect(windowless_context_, rect.ToCGRect()); |
| 351 } | 351 } |
| 352 CGContextClipToRect(windowless_context_, rect.ToCGRect()); | 352 CGContextClipToRect(windowless_context_, rect.ToCGRect()); |
| 353 delegate_->Paint(windowless_context_, rect); | 353 // TODO(caryclark): This is a temporary workaround to allow the Darwin / Skia |
| 354 // port to share code with the Darwin / CG port. All ports will eventually use |
| 355 // the common code below. |
| 356 delegate_->CGPaint(windowless_context_, rect); |
| 354 if (windowless_context_.get() == saved_context_weak) | 357 if (windowless_context_.get() == saved_context_weak) |
| 355 CGContextRestoreGState(windowless_context_); | 358 CGContextRestoreGState(windowless_context_); |
| 356 #else | 359 #else |
| 357 windowless_canvas_->save(); | 360 windowless_canvas_->save(); |
| 358 | 361 |
| 359 // The given clip rect is relative to the plugin coordinate system. | 362 // The given clip rect is relative to the plugin coordinate system. |
| 360 SkRect sk_rect = { SkIntToScalar(rect.x()), | 363 SkRect sk_rect = { SkIntToScalar(rect.x()), |
| 361 SkIntToScalar(rect.y()), | 364 SkIntToScalar(rect.y()), |
| 362 SkIntToScalar(rect.right()), | 365 SkIntToScalar(rect.right()), |
| 363 SkIntToScalar(rect.bottom()) }; | 366 SkIntToScalar(rect.bottom()) }; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 resource_clients_.erase(index++); | 650 resource_clients_.erase(index++); |
| 648 } else { | 651 } else { |
| 649 index++; | 652 index++; |
| 650 } | 653 } |
| 651 } | 654 } |
| 652 } | 655 } |
| 653 | 656 |
| 654 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { | 657 void WebPluginProxy::URLRedirectResponse(bool allow, int resource_id) { |
| 655 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); | 658 Send(new PluginHostMsg_URLRedirectResponse(route_id_, allow, resource_id)); |
| 656 } | 659 } |
| OLD | NEW |