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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 235 } |
236 | 236 |
237 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { | 237 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { |
238 DCHECK(scale > 0); | 238 DCHECK(scale > 0); |
239 if (size_in_pixel.IsEmpty() || scale <= 0) | 239 if (size_in_pixel.IsEmpty() || scale <= 0) |
240 return; | 240 return; |
241 size_ = size_in_pixel; | 241 size_ = size_in_pixel; |
242 host_.setViewportSize(size_in_pixel); | 242 host_.setViewportSize(size_in_pixel); |
243 root_web_layer_.setBounds(size_in_pixel); | 243 root_web_layer_.setBounds(size_in_pixel); |
244 | 244 |
245 if (device_scale_factor_ != scale && IsDIPEnabled()) { | 245 if (device_scale_factor_ != scale) { |
246 device_scale_factor_ = scale; | 246 device_scale_factor_ = scale; |
247 if (root_layer_) | 247 if (root_layer_) |
248 root_layer_->OnDeviceScaleFactorChanged(scale); | 248 root_layer_->OnDeviceScaleFactorChanged(scale); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 void Compositor::AddObserver(CompositorObserver* observer) { | 252 void Compositor::AddObserver(CompositorObserver* observer) { |
253 observer_list_.AddObserver(observer); | 253 observer_list_.AddObserver(observer); |
254 } | 254 } |
255 | 255 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 COMPOSITOR_EXPORT void DisableTestCompositor() { | 357 COMPOSITOR_EXPORT void DisableTestCompositor() { |
358 test_compositor_enabled = false; | 358 test_compositor_enabled = false; |
359 } | 359 } |
360 | 360 |
361 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 361 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
362 return test_compositor_enabled; | 362 return test_compositor_enabled; |
363 } | 363 } |
364 | 364 |
365 } // namespace ui | 365 } // namespace ui |
OLD | NEW |