| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (!compositor->initialize(settings)) | 289 if (!compositor->initialize(settings)) |
| 290 return scoped_ptr<RenderWidgetCompositor>(); | 290 return scoped_ptr<RenderWidgetCompositor>(); |
| 291 | 291 |
| 292 return compositor.Pass(); | 292 return compositor.Pass(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, | 295 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, |
| 296 bool threaded) | 296 bool threaded) |
| 297 : threaded_(threaded), | 297 : threaded_(threaded), |
| 298 suppress_schedule_composite_(false), | 298 suppress_schedule_composite_(false), |
| 299 widget_(widget) { | 299 widget_(widget), |
| 300 saved_device_scale_factor_(0.f) { |
| 300 } | 301 } |
| 301 | 302 |
| 302 RenderWidgetCompositor::~RenderWidgetCompositor() {} | 303 RenderWidgetCompositor::~RenderWidgetCompositor() {} |
| 303 | 304 |
| 304 const base::WeakPtr<cc::InputHandler>& | 305 const base::WeakPtr<cc::InputHandler>& |
| 305 RenderWidgetCompositor::GetInputHandler() { | 306 RenderWidgetCompositor::GetInputHandler() { |
| 306 return layer_tree_host_->GetInputHandler(); | 307 return layer_tree_host_->GetInputHandler(); |
| 307 } | 308 } |
| 308 | 309 |
| 309 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { | 310 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 WebSize RenderWidgetCompositor::deviceViewportSize() const { | 408 WebSize RenderWidgetCompositor::deviceViewportSize() const { |
| 408 return layer_tree_host_->device_viewport_size(); | 409 return layer_tree_host_->device_viewport_size(); |
| 409 } | 410 } |
| 410 | 411 |
| 411 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( | 412 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( |
| 412 const WebFloatPoint& point) const { | 413 const WebFloatPoint& point) const { |
| 413 return point; | 414 return point; |
| 414 } | 415 } |
| 415 | 416 |
| 416 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { | 417 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { |
| 417 layer_tree_host_->SetDeviceScaleFactor(device_scale); | 418 if (saved_device_scale_factor_) |
| 419 saved_device_scale_factor_ = device_scale; |
| 420 else |
| 421 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
| 422 } |
| 423 |
| 424 void RenderWidgetCompositor::OverrideDeviceScaleFactor(float device_scale) { |
| 425 if (device_scale) { |
| 426 saved_device_scale_factor_ = deviceScaleFactor(); |
| 427 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
| 428 } else { |
| 429 layer_tree_host_->SetDeviceScaleFactor(saved_device_scale_factor_); |
| 430 saved_device_scale_factor_ = 0.f; |
| 431 } |
| 418 } | 432 } |
| 419 | 433 |
| 420 float RenderWidgetCompositor::deviceScaleFactor() const { | 434 float RenderWidgetCompositor::deviceScaleFactor() const { |
| 421 return layer_tree_host_->device_scale_factor(); | 435 return layer_tree_host_->device_scale_factor(); |
| 422 } | 436 } |
| 423 | 437 |
| 424 void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { | 438 void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { |
| 425 layer_tree_host_->set_background_color(color); | 439 layer_tree_host_->set_background_color(color); |
| 426 } | 440 } |
| 427 | 441 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 597 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 584 } | 598 } |
| 585 | 599 |
| 586 scoped_refptr<cc::ContextProvider> | 600 scoped_refptr<cc::ContextProvider> |
| 587 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 601 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
| 588 return RenderThreadImpl::current()-> | 602 return RenderThreadImpl::current()-> |
| 589 OffscreenContextProviderForCompositorThread(); | 603 OffscreenContextProviderForCompositorThread(); |
| 590 } | 604 } |
| 591 | 605 |
| 592 } // namespace content | 606 } // namespace content |
| OLD | NEW |