| 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.h" | 5 #include "cc/layers/painted_scrollbar_layer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/layers/painted_scrollbar_layer_impl.h" | 10 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() { | 187 void PaintedScrollbarLayer::UpdateThumbAndTrackGeometry() { |
| 188 UpdateProperty(scrollbar_->TrackRect(), &track_rect_); | 188 UpdateProperty(scrollbar_->TrackRect(), &track_rect_); |
| 189 UpdateProperty(scrollbar_->Location(), &location_); | 189 UpdateProperty(scrollbar_->Location(), &location_); |
| 190 UpdateProperty(scrollbar_->IsOverlay(), &is_overlay_); | 190 UpdateProperty(scrollbar_->IsOverlay(), &is_overlay_); |
| 191 UpdateProperty(scrollbar_->HasThumb(), &has_thumb_); | 191 UpdateProperty(scrollbar_->HasThumb(), &has_thumb_); |
| 192 if (has_thumb_) { | 192 if (has_thumb_) { |
| 193 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); | 193 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); |
| 194 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); | 194 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); |
| 195 } else { |
| 196 UpdateProperty(0, &thumb_thickness_); |
| 197 UpdateProperty(0, &thumb_length_); |
| 195 } | 198 } |
| 196 } | 199 } |
| 197 | 200 |
| 198 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, | 201 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, |
| 199 const OcclusionTracker<Layer>* occlusion) { | 202 const OcclusionTracker<Layer>* occlusion) { |
| 200 UpdateThumbAndTrackGeometry(); | 203 UpdateThumbAndTrackGeometry(); |
| 201 | 204 |
| 202 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); | 205 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); |
| 203 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( | 206 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( |
| 204 track_layer_rect); | 207 track_layer_rect); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 266 |
| 264 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 267 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
| 265 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 268 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
| 266 // allocation and copying. | 269 // allocation and copying. |
| 267 skbitmap.setImmutable(); | 270 skbitmap.setImmutable(); |
| 268 | 271 |
| 269 return UIResourceBitmap(skbitmap); | 272 return UIResourceBitmap(skbitmap); |
| 270 } | 273 } |
| 271 | 274 |
| 272 } // namespace cc | 275 } // namespace cc |
| OLD | NEW |