Chromium Code Reviews| 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 "content/browser/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 10 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 } | 595 } |
| 596 | 596 |
| 597 void BrowserPluginGuest::OnUpdateRect( | 597 void BrowserPluginGuest::OnUpdateRect( |
| 598 const ViewHostMsg_UpdateRect_Params& params) { | 598 const ViewHostMsg_UpdateRect_Params& params) { |
| 599 | 599 |
| 600 BrowserPluginMsg_UpdateRect_Params relay_params; | 600 BrowserPluginMsg_UpdateRect_Params relay_params; |
| 601 relay_params.view_size = params.view_size; | 601 relay_params.view_size = params.view_size; |
| 602 relay_params.scale_factor = params.scale_factor; | 602 relay_params.scale_factor = params.scale_factor; |
| 603 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( | 603 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( |
| 604 params.flags); | 604 params.flags); |
| 605 relay_params.needs_ack = params.needs_ack; | |
| 605 | 606 |
| 606 // HW accelerated case, acknowledge resize only | 607 // HW accelerated case, acknowledge resize only |
| 607 if (!params.needs_ack) { | 608 if (!params.needs_ack) { |
| 608 relay_params.damage_buffer_sequence_id = 0; | 609 relay_params.damage_buffer_sequence_id = 0; |
| 609 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect( | 610 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect( |
| 610 embedder_routing_id(), | 611 embedder_routing_id(), |
| 611 instance_id(), | 612 instance_id(), |
| 612 relay_params)); | 613 relay_params)); |
| 613 return; | 614 return; |
| 614 } | 615 } |
| 615 | 616 |
| 616 RenderViewHost* render_view_host = web_contents()->GetRenderViewHost(); | 617 RenderViewHost* render_view_host = web_contents()->GetRenderViewHost(); |
| 617 // Only copy damage if the guest is in autosize mode and the guest's view size | 618 // Only copy damage if the guest is in autosize mode and the guest's view size |
| 618 // is less than the maximum size or the guest's view size is equal to the | 619 // is less than the maximum size or the guest's view size is equal to the |
| 619 // damage buffer's size and the guest's scale factor is equal to the damage | 620 // damage buffer's size and the guest's scale factor is equal to the damage |
| 620 // buffer's scale factor. | 621 // buffer's scale factor. |
| 621 // The scaling change can happen due to asynchronous updates of the DPI on a | 622 // The scaling change can happen due to asynchronous updates of the DPI on a |
| 622 // resolution change. | 623 // resolution change. |
| 623 if (((auto_size_enabled_ && InAutoSizeBounds(params.view_size)) || | 624 if (((auto_size_enabled_ && InAutoSizeBounds(params.view_size)) || |
|
Cris Neckar
2013/01/08 23:22:35
ditto
| |
| 624 (params.view_size.width() == damage_view_size().width() && | 625 (params.view_size.width() == damage_view_size().width() && |
| 625 params.view_size.height() == damage_view_size().height())) && | 626 params.view_size.height() == damage_view_size().height())) && |
| 626 params.scale_factor == damage_buffer_scale_factor()) { | 627 params.scale_factor == damage_buffer_scale_factor()) { |
| 627 TransportDIB* dib = render_view_host->GetProcess()-> | 628 TransportDIB* dib = render_view_host->GetProcess()-> |
| 628 GetTransportDIB(params.bitmap); | 629 GetTransportDIB(params.bitmap); |
| 629 if (dib) { | 630 if (dib) { |
| 630 size_t guest_damage_buffer_size = | 631 size_t guest_damage_buffer_size = |
| 631 #if defined(OS_WIN) | 632 #if defined(OS_WIN) |
| 632 params.bitmap_rect.width() * | 633 params.bitmap_rect.width() * |
| 633 params.bitmap_rect.height() * 4; | 634 params.bitmap_rect.height() * 4; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 647 relay_params.scroll_delta = params.scroll_delta; | 648 relay_params.scroll_delta = params.scroll_delta; |
| 648 relay_params.scroll_rect = params.scroll_rect; | 649 relay_params.scroll_rect = params.scroll_rect; |
| 649 relay_params.copy_rects = params.copy_rects; | 650 relay_params.copy_rects = params.copy_rects; |
| 650 | 651 |
| 651 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(embedder_routing_id(), | 652 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(embedder_routing_id(), |
| 652 instance_id(), | 653 instance_id(), |
| 653 relay_params)); | 654 relay_params)); |
| 654 } | 655 } |
| 655 | 656 |
| 656 } // namespace content | 657 } // namespace content |
| OLD | NEW |