Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: cc/layers/painted_scrollbar_layer.cc

Issue 2323423002: cc: Add SwapPromiseManager and SurfaceSequenceGenerator. (Closed)
Patch Set: keep LTH in Layer. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); 163 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_);
164 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); 164 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_);
165 } else { 165 } else {
166 UpdateProperty(0, &thumb_thickness_); 166 UpdateProperty(0, &thumb_thickness_);
167 UpdateProperty(0, &thumb_length_); 167 UpdateProperty(0, &thumb_length_);
168 } 168 }
169 } 169 }
170 170
171 void PaintedScrollbarLayer::UpdateInternalContentScale() { 171 void PaintedScrollbarLayer::UpdateInternalContentScale() {
172 float scale = GetLayerTree()->device_scale_factor(); 172 float scale = GetLayerTree()->device_scale_factor();
173 if (GetLayerTree() 173 if (layer_tree_host()
174 ->GetSettings() 174 ->GetSettings()
175 .layer_transforms_should_scale_layer_contents) { 175 .layer_transforms_should_scale_layer_contents) {
176 gfx::Transform transform; 176 gfx::Transform transform;
177 transform = draw_property_utils::ScreenSpaceTransform( 177 transform = draw_property_utils::ScreenSpaceTransform(
178 this, GetLayerTree()->property_trees()->transform_tree); 178 this, GetLayerTree()->property_trees()->transform_tree);
179 179
180 gfx::Vector2dF transform_scales = 180 gfx::Vector2dF transform_scales =
181 MathUtil::ComputeTransform2dScaleComponents(transform, scale); 181 MathUtil::ComputeTransform2dScaleComponents(transform, scale);
182 scale = std::max(transform_scales.x(), transform_scales.y()); 182 scale = std::max(transform_scales.x(), transform_scales.y());
183 } 183 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 thumb_resource_ = nullptr; 222 thumb_resource_ = nullptr;
223 SetNeedsPushProperties(); 223 SetNeedsPushProperties();
224 updated = true; 224 updated = true;
225 } 225 }
226 226
227 if (update_rect().IsEmpty() && track_resource_) 227 if (update_rect().IsEmpty() && track_resource_)
228 return updated; 228 return updated;
229 229
230 if (!track_resource_ || scrollbar_->NeedsPaintPart(TRACK)) { 230 if (!track_resource_ || scrollbar_->NeedsPaintPart(TRACK)) {
231 track_resource_ = ScopedUIResource::Create( 231 track_resource_ = ScopedUIResource::Create(
232 GetLayerTree()->GetUIResourceManager(), 232 layer_tree_host()->GetUIResourceManager(),
233 RasterizeScrollbarPart(track_layer_rect, scaled_track_rect, TRACK)); 233 RasterizeScrollbarPart(track_layer_rect, scaled_track_rect, TRACK));
234 } 234 }
235 235
236 gfx::Rect thumb_layer_rect = OriginThumbRect(); 236 gfx::Rect thumb_layer_rect = OriginThumbRect();
237 gfx::Rect scaled_thumb_rect = 237 gfx::Rect scaled_thumb_rect =
238 ScrollbarLayerRectToContentRect(thumb_layer_rect); 238 ScrollbarLayerRectToContentRect(thumb_layer_rect);
239 if (has_thumb_ && !scaled_thumb_rect.IsEmpty()) { 239 if (has_thumb_ && !scaled_thumb_rect.IsEmpty()) {
240 if (!thumb_resource_ || scrollbar_->NeedsPaintPart(THUMB) || 240 if (!thumb_resource_ || scrollbar_->NeedsPaintPart(THUMB) ||
241 scaled_thumb_rect.size() != 241 scaled_thumb_rect.size() !=
242 thumb_resource_->GetBitmap(0, false).GetSize()) { 242 thumb_resource_->GetBitmap(0, false).GetSize()) {
243 thumb_resource_ = ScopedUIResource::Create( 243 thumb_resource_ = ScopedUIResource::Create(
244 GetLayerTree()->GetUIResourceManager(), 244 layer_tree_host()->GetUIResourceManager(),
245 RasterizeScrollbarPart(thumb_layer_rect, scaled_thumb_rect, THUMB)); 245 RasterizeScrollbarPart(thumb_layer_rect, scaled_thumb_rect, THUMB));
246 } 246 }
247 thumb_opacity_ = scrollbar_->ThumbOpacity(); 247 thumb_opacity_ = scrollbar_->ThumbOpacity();
248 } 248 }
249 249
250 // UI resources changed so push properties is needed. 250 // UI resources changed so push properties is needed.
251 SetNeedsPushProperties(); 251 SetNeedsPushProperties();
252 updated = true; 252 updated = true;
253 return updated; 253 return updated;
254 } 254 }
(...skipping 28 matching lines...) Expand all
283 283
284 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 284 scrollbar_->PaintPart(&skcanvas, part, layer_rect);
285 // Make sure that the pixels are no longer mutable to unavoid unnecessary 285 // Make sure that the pixels are no longer mutable to unavoid unnecessary
286 // allocation and copying. 286 // allocation and copying.
287 skbitmap.setImmutable(); 287 skbitmap.setImmutable();
288 288
289 return UIResourceBitmap(skbitmap); 289 return UIResourceBitmap(skbitmap);
290 } 290 }
291 291
292 } // namespace cc 292 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698