Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10941017: Change the scale factor of texture_size from the layer's one to an estimation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 : host_(RenderWidgetHostImpl::From(host)), 216 : host_(RenderWidgetHostImpl::From(host)),
217 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), 217 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
218 in_shutdown_(false), 218 in_shutdown_(false),
219 is_fullscreen_(false), 219 is_fullscreen_(false),
220 popup_parent_host_view_(NULL), 220 popup_parent_host_view_(NULL),
221 popup_child_host_view_(NULL), 221 popup_child_host_view_(NULL),
222 is_loading_(false), 222 is_loading_(false),
223 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 223 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
224 can_compose_inline_(true), 224 can_compose_inline_(true),
225 has_composition_text_(false), 225 has_composition_text_(false),
226 device_scale_factor_(1.0f),
226 current_surface_(0), 227 current_surface_(0),
227 current_surface_is_protected_(true), 228 current_surface_is_protected_(true),
228 current_surface_in_use_by_compositor_(true), 229 current_surface_in_use_by_compositor_(true),
229 protection_state_id_(0), 230 protection_state_id_(0),
230 surface_route_id_(0), 231 surface_route_id_(0),
231 paint_canvas_(NULL), 232 paint_canvas_(NULL),
232 synthetic_move_sent_(false), 233 synthetic_move_sent_(false),
233 accelerated_compositing_state_changed_(false) { 234 accelerated_compositing_state_changed_(false) {
234 host_->SetView(this); 235 host_->SetView(this);
235 window_observer_.reset(new WindowObserver(this)); 236 window_observer_.reset(new WindowObserver(this));
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 857 }
857 858
858 // TODO(backer): Drop the |shm_handle| once I remove some unused service side 859 // TODO(backer): Drop the |shm_handle| once I remove some unused service side
859 // code. 860 // code.
860 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( 861 void RenderWidgetHostViewAura::AcceleratedSurfaceNew(
861 int32 width_in_pixel, 862 int32 width_in_pixel,
862 int32 height_in_pixel, 863 int32 height_in_pixel,
863 uint64 surface_handle) { 864 uint64 surface_handle) {
864 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 865 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
865 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient( 866 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient(
866 gfx::Size(width_in_pixel, height_in_pixel), surface_handle)); 867 gfx::Size(width_in_pixel, height_in_pixel), device_scale_factor_,
868 surface_handle));
867 if (!surface) { 869 if (!surface) {
868 LOG(ERROR) << "Failed to create ImageTransport texture"; 870 LOG(ERROR) << "Failed to create ImageTransport texture";
869 return; 871 return;
870 } 872 }
871 873
872 image_transport_clients_[surface_handle] = surface; 874 image_transport_clients_[surface_handle] = surface;
873 } 875 }
874 876
875 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease( 877 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(
876 uint64 surface_handle) { 878 uint64 surface_handle) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } else if (aura::Env::GetInstance()->render_white_bg()) { 1281 } else if (aura::Env::GetInstance()->render_white_bg()) {
1280 canvas->DrawColor(SK_ColorWHITE); 1282 canvas->DrawColor(SK_ColorWHITE);
1281 } 1283 }
1282 } 1284 }
1283 1285
1284 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( 1286 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
1285 float device_scale_factor) { 1287 float device_scale_factor) {
1286 if (!host_) 1288 if (!host_)
1287 return; 1289 return;
1288 1290
1291 device_scale_factor_ = device_scale_factor;
1289 BackingStoreAura* backing_store = static_cast<BackingStoreAura*>( 1292 BackingStoreAura* backing_store = static_cast<BackingStoreAura*>(
1290 host_->GetBackingStore(false)); 1293 host_->GetBackingStore(false));
1291 if (backing_store) // NULL in hardware path. 1294 if (backing_store) // NULL in hardware path.
1292 backing_store->ScaleFactorChanged(device_scale_factor); 1295 backing_store->ScaleFactorChanged(device_scale_factor);
1293 1296
1294 host_->SetDeviceScaleFactor(device_scale_factor); 1297 host_->SetDeviceScaleFactor(device_scale_factor);
1295 current_cursor_.SetScaleFactor(device_scale_factor); 1298 current_cursor_.SetScaleFactor(device_scale_factor);
1296 } 1299 }
1297 1300
1298 void RenderWidgetHostViewAura::OnWindowDestroying() { 1301 void RenderWidgetHostViewAura::OnWindowDestroying() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 return scoped_refptr<ui::Texture>(); 1337 return scoped_refptr<ui::Texture>();
1335 1338
1336 ui::Texture* container = it->second; 1339 ui::Texture* container = it->second;
1337 DCHECK(container); 1340 DCHECK(container);
1338 WebKit::WebGLId texture_id = 1341 WebKit::WebGLId texture_id =
1339 gl_helper->CopyTexture(container->texture_id(), container->size()); 1342 gl_helper->CopyTexture(container->texture_id(), container->size());
1340 if (!texture_id) 1343 if (!texture_id)
1341 return scoped_refptr<ui::Texture>(); 1344 return scoped_refptr<ui::Texture>();
1342 1345
1343 return scoped_refptr<ui::Texture>( 1346 return scoped_refptr<ui::Texture>(
1344 factory->CreateOwnedTexture(container->size(), texture_id)); 1347 factory->CreateOwnedTexture(
1348 container->size(), device_scale_factor_, texture_id));
1345 } 1349 }
1346 1350
1347 //////////////////////////////////////////////////////////////////////////////// 1351 ////////////////////////////////////////////////////////////////////////////////
1348 // RenderWidgetHostViewAura, ui::EventHandler implementation: 1352 // RenderWidgetHostViewAura, ui::EventHandler implementation:
1349 1353
1350 ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { 1354 ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
1351 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); 1355 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent");
1352 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && 1356 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() &&
1353 popup_child_host_view_->OnKeyEvent(event)) 1357 popup_child_host_view_->OnKeyEvent(event))
1354 return ui::ER_HANDLED; 1358 return ui::ER_HANDLED;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 RenderWidgetHost* widget) { 1795 RenderWidgetHost* widget) {
1792 return new RenderWidgetHostViewAura(widget); 1796 return new RenderWidgetHostViewAura(widget);
1793 } 1797 }
1794 1798
1795 // static 1799 // static
1796 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1800 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1797 GetScreenInfoForWindow(results, NULL); 1801 GetScreenInfoForWindow(results, NULL);
1798 } 1802 }
1799 1803
1800 } // namespace content 1804 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698