OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/plugin/webplugin_proxy.h" | 5 #include "chrome/plugin/webplugin_proxy.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include "app/win_util.h" | 9 #include "app/win_util.h" |
10 #endif | 10 #endif |
| 11 #include "base/gfx/blit.h" |
11 #include "base/scoped_handle.h" | 12 #include "base/scoped_handle.h" |
12 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
13 #include "base/singleton.h" | 14 #include "base/singleton.h" |
14 #include "base/waitable_event.h" | 15 #include "base/waitable_event.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
17 #include "chrome/common/plugin_messages.h" | 18 #include "chrome/common/plugin_messages.h" |
18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
19 #include "chrome/plugin/npobject_proxy.h" | 20 #include "chrome/plugin/npobject_proxy.h" |
20 #include "chrome/plugin/npobject_util.h" | 21 #include "chrome/plugin/npobject_util.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 scoped_cftyperef<CGImageRef> image( | 418 scoped_cftyperef<CGImageRef> image( |
418 CGBitmapContextCreateImage(background_context_)); | 419 CGBitmapContextCreateImage(background_context_)); |
419 scoped_cftyperef<CGImageRef> sub_image( | 420 scoped_cftyperef<CGImageRef> sub_image( |
420 CGImageCreateWithImageInRect(image, rect.ToCGRect())); | 421 CGImageCreateWithImageInRect(image, rect.ToCGRect())); |
421 CGContextDrawImage(background_context_, rect.ToCGRect(), sub_image); | 422 CGContextDrawImage(background_context_, rect.ToCGRect(), sub_image); |
422 } | 423 } |
423 CGContextClipToRect(windowless_context_, rect.ToCGRect()); | 424 CGContextClipToRect(windowless_context_, rect.ToCGRect()); |
424 delegate_->Paint(windowless_context_, rect); | 425 delegate_->Paint(windowless_context_, rect); |
425 CGContextRestoreGState(windowless_context_); | 426 CGContextRestoreGState(windowless_context_); |
426 #else | 427 #else |
| 428 if (background_canvas_.get()) { |
| 429 BlitCanvasToCanvas(windowless_canvas_.get(), rect, |
| 430 background_canvas_.get(), rect.origin()); |
| 431 } |
427 cairo_t* cairo = | 432 cairo_t* cairo = |
428 windowless_canvas_->getTopPlatformDevice().beginPlatformPaint(); | 433 windowless_canvas_->getTopPlatformDevice().beginPlatformPaint(); |
429 cairo_save(cairo); | 434 cairo_save(cairo); |
430 cairo_rectangle(cairo, rect.x(), rect.y(), rect.width(), rect.height()); | 435 cairo_rectangle(cairo, rect.x(), rect.y(), rect.width(), rect.height()); |
431 cairo_clip(cairo); | 436 cairo_clip(cairo); |
432 if (background_canvas_.get()) { | |
433 cairo_t *background = | |
434 background_canvas_->getTopPlatformDevice().beginPlatformPaint(); | |
435 cairo_set_source_surface(cairo, cairo_get_target(background), 0, 0); | |
436 cairo_paint(cairo); | |
437 } | |
438 cairo_translate(cairo, -delegate_->GetRect().x(), -delegate_->GetRect().y()); | 437 cairo_translate(cairo, -delegate_->GetRect().x(), -delegate_->GetRect().y()); |
439 delegate_->Paint(cairo, offset_rect); | 438 delegate_->Paint(cairo, offset_rect); |
440 cairo_restore(cairo); | 439 cairo_restore(cairo); |
441 #endif | 440 #endif |
442 } | 441 } |
443 | 442 |
444 void WebPluginProxy::UpdateGeometry( | 443 void WebPluginProxy::UpdateGeometry( |
445 const gfx::Rect& window_rect, | 444 const gfx::Rect& window_rect, |
446 const gfx::Rect& clip_rect, | 445 const gfx::Rect& clip_rect, |
447 const TransportDIB::Handle& windowless_buffer, | 446 const TransportDIB::Handle& windowless_buffer, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 while (index != resource_clients_.end()) { | 628 while (index != resource_clients_.end()) { |
630 WebPluginResourceClient* client = (*index).second; | 629 WebPluginResourceClient* client = (*index).second; |
631 | 630 |
632 if (client == resource_client) { | 631 if (client == resource_client) { |
633 resource_clients_.erase(index++); | 632 resource_clients_.erase(index++); |
634 } else { | 633 } else { |
635 index++; | 634 index++; |
636 } | 635 } |
637 } | 636 } |
638 } | 637 } |
OLD | NEW |