| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 584 } |
| 585 | 585 |
| 586 void PluginInstance::ViewChanged(const gfx::Rect& position, | 586 void PluginInstance::ViewChanged(const gfx::Rect& position, |
| 587 const gfx::Rect& clip) { | 587 const gfx::Rect& clip) { |
| 588 if (position.size() != position_.size() && bound_graphics_3d()) { | 588 if (position.size() != position_.size() && bound_graphics_3d()) { |
| 589 // TODO(apatrick): This is a hack to force the back buffer to resize. | 589 // TODO(apatrick): This is a hack to force the back buffer to resize. |
| 590 // It is obviously wrong to call SwapBuffers when a partial frame has | 590 // It is obviously wrong to call SwapBuffers when a partial frame has |
| 591 // potentially been rendered. Plan is to embed resize commands in the | 591 // potentially been rendered. Plan is to embed resize commands in the |
| 592 // command buffer just before ViewChanged is called. | 592 // command buffer just before ViewChanged is called. |
| 593 bound_graphics_3d()->ResizeBackingTexture(position.size()); | 593 bound_graphics_3d()->ResizeBackingTexture(position.size()); |
| 594 bound_graphics_3d()->SwapBuffers(PP_BlockUntilComplete()); | 594 bound_graphics_3d()->SwapBuffers(); |
| 595 } | 595 } |
| 596 | 596 |
| 597 position_ = position; | 597 position_ = position; |
| 598 | 598 |
| 599 if (clip.IsEmpty()) { | 599 if (clip.IsEmpty()) { |
| 600 // WebKit can give weird (x,y) positions for empty clip rects (since the | 600 // WebKit can give weird (x,y) positions for empty clip rects (since the |
| 601 // position technically doesn't matter). But we want to make these | 601 // position technically doesn't matter). But we want to make these |
| 602 // consistent since this is given to the plugin, so force everything to 0 | 602 // consistent since this is given to the plugin, so force everything to 0 |
| 603 // in the "everything is clipped" case. | 603 // in the "everything is clipped" case. |
| 604 clip_ = gfx::Rect(); | 604 clip_ = gfx::Rect(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 632 has_content_area_focus_ = has_focus; | 632 has_content_area_focus_ = has_focus; |
| 633 if (PluginHasFocus() != old_plugin_focus) { | 633 if (PluginHasFocus() != old_plugin_focus) { |
| 634 instance_interface_->DidChangeFocus(pp_instance(), | 634 instance_interface_->DidChangeFocus(pp_instance(), |
| 635 BoolToPPBool(PluginHasFocus())); | 635 BoolToPPBool(PluginHasFocus())); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 | 638 |
| 639 void PluginInstance::ViewInitiatedPaint() { | 639 void PluginInstance::ViewInitiatedPaint() { |
| 640 if (bound_graphics_2d()) | 640 if (bound_graphics_2d()) |
| 641 bound_graphics_2d()->ViewInitiatedPaint(); | 641 bound_graphics_2d()->ViewInitiatedPaint(); |
| 642 if (bound_graphics_3d()) | |
| 643 bound_graphics_3d()->ViewInitiatedPaint(); | |
| 644 } | 642 } |
| 645 | 643 |
| 646 void PluginInstance::ViewFlushedPaint() { | 644 void PluginInstance::ViewFlushedPaint() { |
| 647 if (bound_graphics_2d()) | 645 if (bound_graphics_2d()) |
| 648 bound_graphics_2d()->ViewFlushedPaint(); | 646 bound_graphics_2d()->ViewFlushedPaint(); |
| 649 if (bound_graphics_3d()) | |
| 650 bound_graphics_3d()->ViewFlushedPaint(); | |
| 651 } | 647 } |
| 652 | 648 |
| 653 bool PluginInstance::GetBitmapForOptimizedPluginPaint( | 649 bool PluginInstance::GetBitmapForOptimizedPluginPaint( |
| 654 const gfx::Rect& paint_bounds, | 650 const gfx::Rect& paint_bounds, |
| 655 TransportDIB** dib, | 651 TransportDIB** dib, |
| 656 gfx::Rect* location, | 652 gfx::Rect* location, |
| 657 gfx::Rect* clip) { | 653 gfx::Rect* clip) { |
| 658 if (!always_on_top_) | 654 if (!always_on_top_) |
| 659 return false; | 655 return false; |
| 660 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) | 656 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const { | 1177 PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const { |
| 1182 if (bound_graphics_.get() == NULL) | 1178 if (bound_graphics_.get() == NULL) |
| 1183 return NULL; | 1179 return NULL; |
| 1184 | 1180 |
| 1185 return bound_graphics_->Cast<PPB_Graphics3D_Impl>(); | 1181 return bound_graphics_->Cast<PPB_Graphics3D_Impl>(); |
| 1186 } | 1182 } |
| 1187 | 1183 |
| 1188 } // namespace ppapi | 1184 } // namespace ppapi |
| 1189 } // namespace webkit | 1185 } // namespace webkit |
| 1190 | 1186 |
| OLD | NEW |