| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 2654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 | 2665 |
| 2666 // Scrolling along an axis resets accumulated root overscroll for that axis. | 2666 // Scrolling along an axis resets accumulated root overscroll for that axis. |
| 2667 if (did_scroll_x) | 2667 if (did_scroll_x) |
| 2668 accumulated_root_overscroll_.set_x(0); | 2668 accumulated_root_overscroll_.set_x(0); |
| 2669 if (did_scroll_y) | 2669 if (did_scroll_y) |
| 2670 accumulated_root_overscroll_.set_y(0); | 2670 accumulated_root_overscroll_.set_y(0); |
| 2671 | 2671 |
| 2672 accumulated_root_overscroll_ += unused_root_delta; | 2672 accumulated_root_overscroll_ += unused_root_delta; |
| 2673 bool did_overscroll = !unused_root_delta.IsZero(); | 2673 bool did_overscroll = !unused_root_delta.IsZero(); |
| 2674 if (did_overscroll && input_handler_client_) { | 2674 if (did_overscroll && input_handler_client_) { |
| 2675 input_handler_client_->DidOverscroll(accumulated_root_overscroll_, | 2675 input_handler_client_->DidOverscroll( |
| 2676 unused_root_delta); | 2676 viewport_point, accumulated_root_overscroll_, unused_root_delta); |
| 2677 } | 2677 } |
| 2678 | 2678 |
| 2679 return did_scroll_content || did_scroll_top_controls; | 2679 return did_scroll_content || did_scroll_top_controls; |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 // This implements scrolling by page as described here: | 2682 // This implements scrolling by page as described here: |
| 2683 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).asp
x#_win32_The_Mouse_Wheel | 2683 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).asp
x#_win32_The_Mouse_Wheel |
| 2684 // for events with WHEEL_PAGESCROLL set. | 2684 // for events with WHEEL_PAGESCROLL set. |
| 2685 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, | 2685 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, |
| 2686 ScrollDirection direction) { | 2686 ScrollDirection direction) { |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 ResourceFormat format = resource_provider_->best_texture_format(); | 3290 ResourceFormat format = resource_provider_->best_texture_format(); |
| 3291 switch (bitmap.GetFormat()) { | 3291 switch (bitmap.GetFormat()) { |
| 3292 case UIResourceBitmap::RGBA8: | 3292 case UIResourceBitmap::RGBA8: |
| 3293 break; | 3293 break; |
| 3294 case UIResourceBitmap::ALPHA_8: | 3294 case UIResourceBitmap::ALPHA_8: |
| 3295 format = ALPHA_8; | 3295 format = ALPHA_8; |
| 3296 break; | 3296 break; |
| 3297 case UIResourceBitmap::ETC1: | 3297 case UIResourceBitmap::ETC1: |
| 3298 format = ETC1; | 3298 format = ETC1; |
| 3299 break; | 3299 break; |
| 3300 }; | 3300 } |
| 3301 id = resource_provider_->CreateResource( | 3301 id = resource_provider_->CreateResource( |
| 3302 bitmap.GetSize(), | 3302 bitmap.GetSize(), |
| 3303 wrap_mode, | 3303 wrap_mode, |
| 3304 ResourceProvider::TextureUsageAny, | 3304 ResourceProvider::TextureUsageAny, |
| 3305 format); | 3305 format); |
| 3306 | 3306 |
| 3307 UIResourceData data; | 3307 UIResourceData data; |
| 3308 data.resource_id = id; | 3308 data.resource_id = id; |
| 3309 data.size = bitmap.GetSize(); | 3309 data.size = bitmap.GetSize(); |
| 3310 data.opaque = bitmap.GetOpaque(); | 3310 data.opaque = bitmap.GetOpaque(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 } | 3406 } |
| 3407 | 3407 |
| 3408 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3408 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3409 std::vector<PictureLayerImpl*>::iterator it = | 3409 std::vector<PictureLayerImpl*>::iterator it = |
| 3410 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3410 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3411 DCHECK(it != picture_layers_.end()); | 3411 DCHECK(it != picture_layers_.end()); |
| 3412 picture_layers_.erase(it); | 3412 picture_layers_.erase(it); |
| 3413 } | 3413 } |
| 3414 | 3414 |
| 3415 } // namespace cc | 3415 } // namespace cc |
| OLD | NEW |