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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 gfx::Size(scrollbar_->ThumbThickness(), scrollbar_->ThumbLength()); | 182 gfx::Size(scrollbar_->ThumbThickness(), scrollbar_->ThumbLength()); |
183 } | 183 } |
184 return gfx::Rect(thumb_size); | 184 return gfx::Rect(thumb_size); |
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 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); |
193 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); | 193 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); |
194 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); | |
195 } | |
196 } | 194 } |
197 | 195 |
198 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, | 196 bool PaintedScrollbarLayer::Update(ResourceUpdateQueue* queue, |
199 const OcclusionTracker<Layer>* occlusion) { | 197 const OcclusionTracker<Layer>* occlusion) { |
200 UpdateThumbAndTrackGeometry(); | 198 UpdateThumbAndTrackGeometry(); |
201 | 199 |
202 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); | 200 gfx::Rect track_layer_rect = gfx::Rect(location_, bounds()); |
203 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( | 201 gfx::Rect scaled_track_rect = ScrollbarLayerRectToContentRect( |
204 track_layer_rect); | 202 track_layer_rect); |
205 | 203 |
206 if (track_rect_.IsEmpty() || scaled_track_rect.IsEmpty()) | 204 if (track_rect_.IsEmpty() || scaled_track_rect.IsEmpty()) |
danakj
2014/09/03 17:20:51
This function never destroys the thumb_resource_ o
MuVen
2014/09/03 18:08:47
Sure. Will work on this.
| |
207 return false; | 205 return false; |
208 | 206 |
209 { | 207 { |
210 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, | 208 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, |
211 true); | 209 true); |
212 ContentsScalingLayer::Update(queue, occlusion); | 210 ContentsScalingLayer::Update(queue, occlusion); |
213 } | 211 } |
214 | 212 |
215 if (update_rect_.IsEmpty() && track_resource_) | 213 if (update_rect_.IsEmpty() && track_resource_) |
216 return false; | 214 return false; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 | 261 |
264 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 262 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
265 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 263 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
266 // allocation and copying. | 264 // allocation and copying. |
267 skbitmap.setImmutable(); | 265 skbitmap.setImmutable(); |
268 | 266 |
269 return UIResourceBitmap(skbitmap); | 267 return UIResourceBitmap(skbitmap); |
270 } | 268 } |
271 | 269 |
272 } // namespace cc | 270 } // namespace cc |
OLD | NEW |