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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 if (!compositor->initialize(settings)) | 292 if (!compositor->initialize(settings)) |
293 return scoped_ptr<RenderWidgetCompositor>(); | 293 return scoped_ptr<RenderWidgetCompositor>(); |
294 | 294 |
295 return compositor.Pass(); | 295 return compositor.Pass(); |
296 } | 296 } |
297 | 297 |
298 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, | 298 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, |
299 bool threaded) | 299 bool threaded) |
300 : threaded_(threaded), | 300 : threaded_(threaded), |
301 suppress_schedule_composite_(false), | 301 suppress_schedule_composite_(false), |
302 widget_(widget) { | 302 widget_(widget), |
| 303 saved_device_scale_factor_(0.f) { |
303 } | 304 } |
304 | 305 |
305 RenderWidgetCompositor::~RenderWidgetCompositor() {} | 306 RenderWidgetCompositor::~RenderWidgetCompositor() {} |
306 | 307 |
307 const base::WeakPtr<cc::InputHandler>& | 308 const base::WeakPtr<cc::InputHandler>& |
308 RenderWidgetCompositor::GetInputHandler() { | 309 RenderWidgetCompositor::GetInputHandler() { |
309 return layer_tree_host_->GetInputHandler(); | 310 return layer_tree_host_->GetInputHandler(); |
310 } | 311 } |
311 | 312 |
312 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { | 313 void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 WebSize RenderWidgetCompositor::deviceViewportSize() const { | 415 WebSize RenderWidgetCompositor::deviceViewportSize() const { |
415 return layer_tree_host_->device_viewport_size(); | 416 return layer_tree_host_->device_viewport_size(); |
416 } | 417 } |
417 | 418 |
418 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( | 419 WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( |
419 const WebFloatPoint& point) const { | 420 const WebFloatPoint& point) const { |
420 return point; | 421 return point; |
421 } | 422 } |
422 | 423 |
423 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { | 424 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { |
424 layer_tree_host_->SetDeviceScaleFactor(device_scale); | 425 if (saved_device_scale_factor_) |
| 426 saved_device_scale_factor_ = device_scale; |
| 427 else |
| 428 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
| 429 } |
| 430 |
| 431 void RenderWidgetCompositor::OverrideDeviceScaleFactor(float device_scale) { |
| 432 if (device_scale) { |
| 433 saved_device_scale_factor_ = deviceScaleFactor(); |
| 434 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
| 435 } else { |
| 436 layer_tree_host_->SetDeviceScaleFactor(saved_device_scale_factor_); |
| 437 saved_device_scale_factor_ = 0.f; |
| 438 } |
425 } | 439 } |
426 | 440 |
427 float RenderWidgetCompositor::deviceScaleFactor() const { | 441 float RenderWidgetCompositor::deviceScaleFactor() const { |
428 return layer_tree_host_->device_scale_factor(); | 442 return layer_tree_host_->device_scale_factor(); |
429 } | 443 } |
430 | 444 |
431 void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { | 445 void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { |
432 layer_tree_host_->set_background_color(color); | 446 layer_tree_host_->set_background_color(color); |
433 } | 447 } |
434 | 448 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 604 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
591 } | 605 } |
592 | 606 |
593 scoped_refptr<cc::ContextProvider> | 607 scoped_refptr<cc::ContextProvider> |
594 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 608 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
595 return RenderThreadImpl::current()-> | 609 return RenderThreadImpl::current()-> |
596 OffscreenContextProviderForCompositorThread(); | 610 OffscreenContextProviderForCompositorThread(); |
597 } | 611 } |
598 | 612 |
599 } // namespace content | 613 } // namespace content |
OLD | NEW |