| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/plugins/npapi/webplugin_delegate_impl.h" | 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #import <QuartzCore/QuartzCore.h> | 8 #import <QuartzCore/QuartzCore.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 DCHECK(!use_buffer_context_ || buffer_context_ == context); | 453 DCHECK(!use_buffer_context_ || buffer_context_ == context); |
| 454 | 454 |
| 455 base::StatsRate plugin_paint("Plugin.Paint"); | 455 base::StatsRate plugin_paint("Plugin.Paint"); |
| 456 base::StatsScope<base::StatsRate> scope(plugin_paint); | 456 base::StatsScope<base::StatsRate> scope(plugin_paint); |
| 457 | 457 |
| 458 gfx::Rect paint_rect; | 458 gfx::Rect paint_rect; |
| 459 if (use_buffer_context_) { | 459 if (use_buffer_context_) { |
| 460 // Plugin invalidates trigger asynchronous paints with the original | 460 // Plugin invalidates trigger asynchronous paints with the original |
| 461 // invalidation rect; the plugin may be resized before the paint is handled, | 461 // invalidation rect; the plugin may be resized before the paint is handled, |
| 462 // so we need to ensure that the damage rect is still sane. | 462 // so we need to ensure that the damage rect is still sane. |
| 463 paint_rect = damage_rect.Intersect( | 463 paint_rect = damage_rect; |
| 464 paint_rect.Intersect( |
| 464 gfx::Rect(0, 0, window_rect_.width(), window_rect_.height())); | 465 gfx::Rect(0, 0, window_rect_.width(), window_rect_.height())); |
| 465 } else { | 466 } else { |
| 466 // Use the actual window region when drawing directly to the window context. | 467 // Use the actual window region when drawing directly to the window context. |
| 467 paint_rect = damage_rect.Intersect(window_rect_); | 468 paint_rect = window_rect_; |
| 469 paint_rect.Intersect(damage_rect); |
| 468 } | 470 } |
| 469 | 471 |
| 470 ScopedActiveDelegate active_delegate(this); | 472 ScopedActiveDelegate active_delegate(this); |
| 471 | 473 |
| 472 CGContextSaveGState(context); | 474 CGContextSaveGState(context); |
| 473 | 475 |
| 474 if (!use_buffer_context_) { | 476 if (!use_buffer_context_) { |
| 475 // Reposition the context origin so that plugins will draw at the correct | 477 // Reposition the context origin so that plugins will draw at the correct |
| 476 // location in the window. | 478 // location in the window. |
| 477 CGContextClipToRect(context, paint_rect.ToCGRect()); | 479 CGContextClipToRect(context, paint_rect.ToCGRect()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 DCHECK(!composited_); | 765 DCHECK(!composited_); |
| 764 windowed_handle_ = handle; | 766 windowed_handle_ = handle; |
| 765 surface_->SetWindowHandle(handle); | 767 surface_->SetWindowHandle(handle); |
| 766 UpdateAcceleratedSurface(); | 768 UpdateAcceleratedSurface(); |
| 767 // Kick off the drawing timer, if necessary. | 769 // Kick off the drawing timer, if necessary. |
| 768 PluginVisibilityChanged(); | 770 PluginVisibilityChanged(); |
| 769 } | 771 } |
| 770 | 772 |
| 771 } // namespace npapi | 773 } // namespace npapi |
| 772 } // namespace webkit | 774 } // namespace webkit |
| OLD | NEW |