OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/painted_scrollbar_layer_impl.h" | 5 #include "cc/layers/painted_scrollbar_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/input/scrollbar_animation_controller.h" | 10 #include "cc/input/scrollbar_animation_controller.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 if (thumb_resource_id && !visible_thumb_quad_rect.IsEmpty()) { | 106 if (thumb_resource_id && !visible_thumb_quad_rect.IsEmpty()) { |
107 gfx::Rect opaque_rect; | 107 gfx::Rect opaque_rect; |
108 const float opacity[] = {thumb_opacity_, thumb_opacity_, thumb_opacity_, | 108 const float opacity[] = {thumb_opacity_, thumb_opacity_, thumb_opacity_, |
109 thumb_opacity_}; | 109 thumb_opacity_}; |
110 TextureDrawQuad* quad = | 110 TextureDrawQuad* quad = |
111 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 111 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
112 quad->SetNew(shared_quad_state, scaled_thumb_quad_rect, opaque_rect, | 112 quad->SetNew(shared_quad_state, scaled_thumb_quad_rect, opaque_rect, |
113 scaled_visible_thumb_quad_rect, thumb_resource_id, | 113 scaled_visible_thumb_quad_rect, thumb_resource_id, |
114 premultipled_alpha, uv_top_left, uv_bottom_right, | 114 premultipled_alpha, uv_top_left, uv_bottom_right, |
115 SK_ColorTRANSPARENT, opacity, flipped, nearest_neighbor); | 115 SK_ColorTRANSPARENT, opacity, flipped, nearest_neighbor, |
| 116 false); |
116 ValidateQuadResources(quad); | 117 ValidateQuadResources(quad); |
117 } | 118 } |
118 | 119 |
119 gfx::Rect track_quad_rect(bounds()); | 120 gfx::Rect track_quad_rect(bounds()); |
120 gfx::Rect scaled_track_quad_rect(internal_content_bounds_); | 121 gfx::Rect scaled_track_quad_rect(internal_content_bounds_); |
121 gfx::Rect visible_track_quad_rect = | 122 gfx::Rect visible_track_quad_rect = |
122 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 123 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
123 track_quad_rect); | 124 track_quad_rect); |
124 gfx::Rect scaled_visible_track_quad_rect = gfx::ScaleToEnclosingRect( | 125 gfx::Rect scaled_visible_track_quad_rect = gfx::ScaleToEnclosingRect( |
125 visible_track_quad_rect, internal_contents_scale_); | 126 visible_track_quad_rect, internal_contents_scale_); |
126 if (track_resource_id && !visible_track_quad_rect.IsEmpty()) { | 127 if (track_resource_id && !visible_track_quad_rect.IsEmpty()) { |
127 gfx::Rect opaque_rect(contents_opaque() ? scaled_track_quad_rect | 128 gfx::Rect opaque_rect(contents_opaque() ? scaled_track_quad_rect |
128 : gfx::Rect()); | 129 : gfx::Rect()); |
129 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 130 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
130 TextureDrawQuad* quad = | 131 TextureDrawQuad* quad = |
131 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 132 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
132 quad->SetNew(shared_quad_state, scaled_track_quad_rect, opaque_rect, | 133 quad->SetNew(shared_quad_state, scaled_track_quad_rect, opaque_rect, |
133 scaled_visible_track_quad_rect, track_resource_id, | 134 scaled_visible_track_quad_rect, track_resource_id, |
134 premultipled_alpha, uv_top_left, uv_bottom_right, | 135 premultipled_alpha, uv_top_left, uv_bottom_right, |
135 SK_ColorTRANSPARENT, opacity, flipped, nearest_neighbor); | 136 SK_ColorTRANSPARENT, opacity, flipped, nearest_neighbor, |
| 137 false); |
136 ValidateQuadResources(quad); | 138 ValidateQuadResources(quad); |
137 } | 139 } |
138 } | 140 } |
139 | 141 |
140 gfx::Rect PaintedScrollbarLayerImpl::GetEnclosingRectInTargetSpace() const { | 142 gfx::Rect PaintedScrollbarLayerImpl::GetEnclosingRectInTargetSpace() const { |
141 if (internal_content_bounds_.IsEmpty()) | 143 if (internal_content_bounds_.IsEmpty()) |
142 return gfx::Rect(); | 144 return gfx::Rect(); |
143 DCHECK_GT(internal_contents_scale_, 0.f); | 145 DCHECK_GT(internal_contents_scale_, 0.f); |
144 return GetScaledEnclosingRectInTargetSpace(internal_contents_scale_); | 146 return GetScaledEnclosingRectInTargetSpace(internal_contents_scale_); |
145 } | 147 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 192 |
191 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { | 193 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { |
192 return false; | 194 return false; |
193 } | 195 } |
194 | 196 |
195 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { | 197 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { |
196 return "cc::PaintedScrollbarLayerImpl"; | 198 return "cc::PaintedScrollbarLayerImpl"; |
197 } | 199 } |
198 | 200 |
199 } // namespace cc | 201 } // namespace cc |
OLD | NEW |