| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/scrollbar_layer_impl.h" | 5 #include "cc/layers/scrollbar_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/animation/scrollbar_animation_controller.h" | 7 #include "cc/animation/scrollbar_animation_controller.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
| 10 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 112 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 113 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 113 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 114 quad->SetNew(shared_quad_state, | 114 quad->SetNew(shared_quad_state, |
| 115 thumb_quad_rect, | 115 thumb_quad_rect, |
| 116 opaque_rect, | 116 opaque_rect, |
| 117 thumb_resource_id_, | 117 thumb_resource_id_, |
| 118 premultipled_alpha, | 118 premultipled_alpha, |
| 119 uv_top_left, | 119 uv_top_left, |
| 120 uv_bottom_right, | 120 uv_bottom_right, |
| 121 opacity, | 121 opacity, |
| 122 SK_ColorTRANSPARENT, |
| 122 flipped); | 123 flipped); |
| 123 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); | 124 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); |
| 124 } | 125 } |
| 125 | 126 |
| 126 if (!track_resource_id_) | 127 if (!track_resource_id_) |
| 127 return; | 128 return; |
| 128 | 129 |
| 129 // Order matters here: since the back track texture is being drawn to the | 130 // Order matters here: since the back track texture is being drawn to the |
| 130 // entire contents rect, we must append it after the thumb and fore track | 131 // entire contents rect, we must append it after the thumb and fore track |
| 131 // quads. The back track texture contains (and displays) the buttons. | 132 // quads. The back track texture contains (and displays) the buttons. |
| 132 if (!content_bounds_rect.IsEmpty()) { | 133 if (!content_bounds_rect.IsEmpty()) { |
| 133 gfx::Rect quad_rect(content_bounds_rect); | 134 gfx::Rect quad_rect(content_bounds_rect); |
| 134 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); | 135 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); |
| 135 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 136 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 136 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 137 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 137 quad->SetNew(shared_quad_state, | 138 quad->SetNew(shared_quad_state, |
| 138 quad_rect, | 139 quad_rect, |
| 139 opaque_rect, | 140 opaque_rect, |
| 140 track_resource_id_, | 141 track_resource_id_, |
| 141 premultipled_alpha, | 142 premultipled_alpha, |
| 142 uv_top_left, | 143 uv_top_left, |
| 143 uv_bottom_right, | 144 uv_bottom_right, |
| 144 opacity, | 145 opacity, |
| 146 SK_ColorTRANSPARENT, |
| 145 flipped); | 147 flipped); |
| 146 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); | 148 quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); |
| 147 } | 149 } |
| 148 } | 150 } |
| 149 | 151 |
| 150 ScrollbarOrientation ScrollbarLayerImpl::Orientation() const { | 152 ScrollbarOrientation ScrollbarLayerImpl::Orientation() const { |
| 151 return orientation_; | 153 return orientation_; |
| 152 } | 154 } |
| 153 | 155 |
| 154 float ScrollbarLayerImpl::CurrentPos() const { | 156 float ScrollbarLayerImpl::CurrentPos() const { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void ScrollbarLayerImpl::DidLoseOutputSurface() { | 263 void ScrollbarLayerImpl::DidLoseOutputSurface() { |
| 262 track_resource_id_ = 0; | 264 track_resource_id_ = 0; |
| 263 thumb_resource_id_ = 0; | 265 thumb_resource_id_ = 0; |
| 264 } | 266 } |
| 265 | 267 |
| 266 const char* ScrollbarLayerImpl::LayerTypeAsString() const { | 268 const char* ScrollbarLayerImpl::LayerTypeAsString() const { |
| 267 return "cc::ScrollbarLayerImpl"; | 269 return "cc::ScrollbarLayerImpl"; |
| 268 } | 270 } |
| 269 | 271 |
| 270 } // namespace cc | 272 } // namespace cc |
| OLD | NEW |