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 <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels()); | 627 unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels()); |
628 CancelCompositorLock(); | 628 CancelCompositorLock(); |
629 PendingSwap pending_swap(READPIXELS_SWAP, posted_swaps_.get()); | 629 PendingSwap pending_swap(READPIXELS_SWAP, posted_swaps_.get()); |
630 return host_->CompositeAndReadback(pixels, bounds_in_pixel); | 630 return host_->CompositeAndReadback(pixels, bounds_in_pixel); |
631 } | 631 } |
632 | 632 |
633 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { | 633 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { |
634 DCHECK_GT(scale, 0); | 634 DCHECK_GT(scale, 0); |
635 if (!size_in_pixel.IsEmpty()) { | 635 if (!size_in_pixel.IsEmpty()) { |
636 size_ = size_in_pixel; | 636 size_ = size_in_pixel; |
637 host_->SetViewportSize(size_in_pixel, size_in_pixel); | 637 host_->SetViewportSize(size_in_pixel); |
638 root_web_layer_->SetBounds(size_in_pixel); | 638 root_web_layer_->SetBounds(size_in_pixel); |
639 | 639 |
640 next_draw_is_resize_ = true; | 640 next_draw_is_resize_ = true; |
641 } | 641 } |
642 if (device_scale_factor_ != scale) { | 642 if (device_scale_factor_ != scale) { |
643 device_scale_factor_ = scale; | 643 device_scale_factor_ = scale; |
644 if (root_layer_) | 644 if (root_layer_) |
645 root_layer_->OnDeviceScaleFactorChanged(scale); | 645 root_layer_->OnDeviceScaleFactorChanged(scale); |
646 } | 646 } |
647 } | 647 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 COMPOSITOR_EXPORT void DisableTestCompositor() { | 810 COMPOSITOR_EXPORT void DisableTestCompositor() { |
811 ResetImplicitFactory(); | 811 ResetImplicitFactory(); |
812 g_test_compositor_enabled = false; | 812 g_test_compositor_enabled = false; |
813 } | 813 } |
814 | 814 |
815 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 815 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
816 return g_test_compositor_enabled; | 816 return g_test_compositor_enabled; |
817 } | 817 } |
818 | 818 |
819 } // namespace ui | 819 } // namespace ui |
OLD | NEW |