| 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 "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE); | 66 DCHECK(draw_mode != DRAW_MODE_RESOURCELESS_SOFTWARE); |
| 67 return LayerImpl::WillDraw(draw_mode, resource_provider); | 67 return LayerImpl::WillDraw(draw_mode, resource_provider); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void PaintedScrollbarLayerImpl::AppendQuads( | 70 void PaintedScrollbarLayerImpl::AppendQuads( |
| 71 RenderPass* render_pass, | 71 RenderPass* render_pass, |
| 72 const Occlusion& occlusion_in_content_space, | 72 const Occlusion& occlusion_in_content_space, |
| 73 AppendQuadsData* append_quads_data) { | 73 AppendQuadsData* append_quads_data) { |
| 74 bool premultipled_alpha = true; | 74 bool premultipled_alpha = true; |
| 75 bool flipped = false; | 75 bool flipped = false; |
| 76 bool nearest_neighbor = false; |
| 76 gfx::PointF uv_top_left(0.f, 0.f); | 77 gfx::PointF uv_top_left(0.f, 0.f); |
| 77 gfx::PointF uv_bottom_right(1.f, 1.f); | 78 gfx::PointF uv_bottom_right(1.f, 1.f); |
| 78 gfx::Rect bounds_rect(bounds()); | 79 gfx::Rect bounds_rect(bounds()); |
| 79 gfx::Rect content_bounds_rect(content_bounds()); | 80 gfx::Rect content_bounds_rect(content_bounds()); |
| 80 | 81 |
| 81 SharedQuadState* shared_quad_state = | 82 SharedQuadState* shared_quad_state = |
| 82 render_pass->CreateAndAppendSharedQuadState(); | 83 render_pass->CreateAndAppendSharedQuadState(); |
| 83 PopulateSharedQuadState(shared_quad_state); | 84 PopulateSharedQuadState(shared_quad_state); |
| 84 | 85 |
| 85 AppendDebugBorderQuad( | 86 AppendDebugBorderQuad( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 quad->SetNew(shared_quad_state, | 103 quad->SetNew(shared_quad_state, |
| 103 thumb_quad_rect, | 104 thumb_quad_rect, |
| 104 opaque_rect, | 105 opaque_rect, |
| 105 visible_thumb_quad_rect, | 106 visible_thumb_quad_rect, |
| 106 thumb_resource_id, | 107 thumb_resource_id, |
| 107 premultipled_alpha, | 108 premultipled_alpha, |
| 108 uv_top_left, | 109 uv_top_left, |
| 109 uv_bottom_right, | 110 uv_bottom_right, |
| 110 SK_ColorTRANSPARENT, | 111 SK_ColorTRANSPARENT, |
| 111 opacity, | 112 opacity, |
| 112 flipped); | 113 flipped, |
| 114 nearest_neighbor); |
| 113 } | 115 } |
| 114 | 116 |
| 115 gfx::Rect track_quad_rect = content_bounds_rect; | 117 gfx::Rect track_quad_rect = content_bounds_rect; |
| 116 gfx::Rect visible_track_quad_rect = | 118 gfx::Rect visible_track_quad_rect = |
| 117 occlusion_in_content_space.GetUnoccludedContentRect(track_quad_rect); | 119 occlusion_in_content_space.GetUnoccludedContentRect(track_quad_rect); |
| 118 if (track_resource_id && !visible_track_quad_rect.IsEmpty()) { | 120 if (track_resource_id && !visible_track_quad_rect.IsEmpty()) { |
| 119 gfx::Rect opaque_rect(contents_opaque() ? track_quad_rect : gfx::Rect()); | 121 gfx::Rect opaque_rect(contents_opaque() ? track_quad_rect : gfx::Rect()); |
| 120 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 122 const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 121 TextureDrawQuad* quad = | 123 TextureDrawQuad* quad = |
| 122 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 124 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 123 quad->SetNew(shared_quad_state, | 125 quad->SetNew(shared_quad_state, |
| 124 track_quad_rect, | 126 track_quad_rect, |
| 125 opaque_rect, | 127 opaque_rect, |
| 126 visible_track_quad_rect, | 128 visible_track_quad_rect, |
| 127 track_resource_id, | 129 track_resource_id, |
| 128 premultipled_alpha, | 130 premultipled_alpha, |
| 129 uv_top_left, | 131 uv_top_left, |
| 130 uv_bottom_right, | 132 uv_bottom_right, |
| 131 SK_ColorTRANSPARENT, | 133 SK_ColorTRANSPARENT, |
| 132 opacity, | 134 opacity, |
| 133 flipped); | 135 flipped, |
| 136 nearest_neighbor); |
| 134 } | 137 } |
| 135 } | 138 } |
| 136 | 139 |
| 137 void PaintedScrollbarLayerImpl::SetThumbThickness(int thumb_thickness) { | 140 void PaintedScrollbarLayerImpl::SetThumbThickness(int thumb_thickness) { |
| 138 if (thumb_thickness_ == thumb_thickness) | 141 if (thumb_thickness_ == thumb_thickness) |
| 139 return; | 142 return; |
| 140 thumb_thickness_ = thumb_thickness; | 143 thumb_thickness_ = thumb_thickness; |
| 141 NoteLayerPropertyChanged(); | 144 NoteLayerPropertyChanged(); |
| 142 } | 145 } |
| 143 | 146 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 183 |
| 181 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { | 184 bool PaintedScrollbarLayerImpl::IsThumbResizable() const { |
| 182 return false; | 185 return false; |
| 183 } | 186 } |
| 184 | 187 |
| 185 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { | 188 const char* PaintedScrollbarLayerImpl::LayerTypeAsString() const { |
| 186 return "cc::PaintedScrollbarLayerImpl"; | 189 return "cc::PaintedScrollbarLayerImpl"; |
| 187 } | 190 } |
| 188 | 191 |
| 189 } // namespace cc | 192 } // namespace cc |
| OLD | NEW |