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

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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 : host_(RenderWidgetHostImpl::From(host)), 255 : host_(RenderWidgetHostImpl::From(host)),
256 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), 256 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
257 in_shutdown_(false), 257 in_shutdown_(false),
258 is_fullscreen_(false), 258 is_fullscreen_(false),
259 popup_parent_host_view_(NULL), 259 popup_parent_host_view_(NULL),
260 popup_child_host_view_(NULL), 260 popup_child_host_view_(NULL),
261 is_loading_(false), 261 is_loading_(false),
262 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 262 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
263 can_compose_inline_(true), 263 can_compose_inline_(true),
264 has_composition_text_(false), 264 has_composition_text_(false),
265 device_scale_factor_(1.0f),
265 current_surface_(0), 266 current_surface_(0),
266 current_surface_is_protected_(true), 267 current_surface_is_protected_(true),
267 current_surface_in_use_by_compositor_(true), 268 current_surface_in_use_by_compositor_(true),
268 protection_state_id_(0), 269 protection_state_id_(0),
269 surface_route_id_(0), 270 surface_route_id_(0),
270 paint_canvas_(NULL), 271 paint_canvas_(NULL),
271 synthetic_move_sent_(false), 272 synthetic_move_sent_(false),
272 accelerated_compositing_state_changed_(false) { 273 accelerated_compositing_state_changed_(false) {
273 host_->SetView(this); 274 host_->SetView(this);
274 window_observer_.reset(new WindowObserver(this)); 275 window_observer_.reset(new WindowObserver(this));
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 } 920 }
920 921
921 // TODO(backer): Drop the |shm_handle| once I remove some unused service side 922 // TODO(backer): Drop the |shm_handle| once I remove some unused service side
922 // code. 923 // code.
923 void RenderWidgetHostViewAura::AcceleratedSurfaceNew( 924 void RenderWidgetHostViewAura::AcceleratedSurfaceNew(
924 int32 width_in_pixel, 925 int32 width_in_pixel,
925 int32 height_in_pixel, 926 int32 height_in_pixel,
926 uint64 surface_handle) { 927 uint64 surface_handle) {
927 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 928 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
928 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient( 929 scoped_refptr<ui::Texture> surface(factory->CreateTransportClient(
929 gfx::Size(width_in_pixel, height_in_pixel), surface_handle)); 930 gfx::Size(width_in_pixel, height_in_pixel), device_scale_factor_,
931 surface_handle));
930 if (!surface) { 932 if (!surface) {
931 LOG(ERROR) << "Failed to create ImageTransport texture"; 933 LOG(ERROR) << "Failed to create ImageTransport texture";
932 return; 934 return;
933 } 935 }
934 936
935 image_transport_clients_[surface_handle] = surface; 937 image_transport_clients_[surface_handle] = surface;
936 } 938 }
937 939
938 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease( 940 void RenderWidgetHostViewAura::AcceleratedSurfaceRelease(
939 uint64 surface_handle) { 941 uint64 surface_handle) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 } else if (aura::Env::GetInstance()->render_white_bg()) { 1344 } else if (aura::Env::GetInstance()->render_white_bg()) {
1343 canvas->DrawColor(SK_ColorWHITE); 1345 canvas->DrawColor(SK_ColorWHITE);
1344 } 1346 }
1345 } 1347 }
1346 1348
1347 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged( 1349 void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
1348 float device_scale_factor) { 1350 float device_scale_factor) {
1349 if (!host_) 1351 if (!host_)
1350 return; 1352 return;
1351 1353
1354 device_scale_factor_ = device_scale_factor;
1352 BackingStoreAura* backing_store = static_cast<BackingStoreAura*>( 1355 BackingStoreAura* backing_store = static_cast<BackingStoreAura*>(
1353 host_->GetBackingStore(false)); 1356 host_->GetBackingStore(false));
1354 if (backing_store) // NULL in hardware path. 1357 if (backing_store) // NULL in hardware path.
1355 backing_store->ScaleFactorChanged(device_scale_factor); 1358 backing_store->ScaleFactorChanged(device_scale_factor);
1356 1359
1357 host_->SetDeviceScaleFactor(device_scale_factor); 1360 host_->SetDeviceScaleFactor(device_scale_factor);
1358 current_cursor_.SetScaleFactor(device_scale_factor); 1361 current_cursor_.SetScaleFactor(device_scale_factor);
1359 } 1362 }
1360 1363
1361 void RenderWidgetHostViewAura::OnWindowDestroying() { 1364 void RenderWidgetHostViewAura::OnWindowDestroying() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 return scoped_refptr<ui::Texture>(); 1406 return scoped_refptr<ui::Texture>();
1404 1407
1405 ui::Texture* container = it->second; 1408 ui::Texture* container = it->second;
1406 DCHECK(container); 1409 DCHECK(container);
1407 WebKit::WebGLId texture_id = 1410 WebKit::WebGLId texture_id =
1408 gl_helper->CopyTexture(container->texture_id(), container->size()); 1411 gl_helper->CopyTexture(container->texture_id(), container->size());
1409 if (!texture_id) 1412 if (!texture_id)
1410 return scoped_refptr<ui::Texture>(); 1413 return scoped_refptr<ui::Texture>();
1411 1414
1412 return scoped_refptr<ui::Texture>( 1415 return scoped_refptr<ui::Texture>(
1413 factory->CreateOwnedTexture(container->size(), texture_id)); 1416 factory->CreateOwnedTexture(
1417 container->size(), device_scale_factor_, texture_id));
1414 } 1418 }
1415 1419
1416 //////////////////////////////////////////////////////////////////////////////// 1420 ////////////////////////////////////////////////////////////////////////////////
1417 // RenderWidgetHostViewAura, ui::EventHandler implementation: 1421 // RenderWidgetHostViewAura, ui::EventHandler implementation:
1418 1422
1419 ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { 1423 ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
1420 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent"); 1424 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnKeyEvent");
1421 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() && 1425 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab() &&
1422 popup_child_host_view_->OnKeyEvent(event)) 1426 popup_child_host_view_->OnKeyEvent(event))
1423 return ui::ER_HANDLED; 1427 return ui::ER_HANDLED;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 RenderWidgetHost* widget) { 1864 RenderWidgetHost* widget) {
1861 return new RenderWidgetHostViewAura(widget); 1865 return new RenderWidgetHostViewAura(widget);
1862 } 1866 }
1863 1867
1864 // static 1868 // static
1865 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1869 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1866 GetScreenInfoForWindow(results, NULL); 1870 GetScreenInfoForWindow(results, NULL);
1867 } 1871 }
1868 1872
1869 } // namespace content 1873 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/aura/bench/bench_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698