OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/base/util.h" | 9 #include "cc/base/util.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 layer_impl->SetIsMask(is_mask_); | 74 layer_impl->SetIsMask(is_mask_); |
75 layer_impl->TransferTilingSet(tilings_.Pass()); | 75 layer_impl->TransferTilingSet(tilings_.Pass()); |
76 layer_impl->pile_ = pile_; | 76 layer_impl->pile_ = pile_; |
77 pile_ = PicturePileImpl::Create(); | 77 pile_ = PicturePileImpl::Create(); |
78 | 78 |
79 layer_impl->raster_page_scale_ = raster_page_scale_; | 79 layer_impl->raster_page_scale_ = raster_page_scale_; |
80 layer_impl->raster_device_scale_ = raster_device_scale_; | 80 layer_impl->raster_device_scale_ = raster_device_scale_; |
81 layer_impl->raster_source_scale_ = raster_source_scale_; | 81 layer_impl->raster_source_scale_ = raster_source_scale_; |
82 } | 82 } |
83 | 83 |
84 | |
85 void PictureLayerImpl::AppendQuads(QuadSink* quadSink, | 84 void PictureLayerImpl::AppendQuads(QuadSink* quadSink, |
86 AppendQuadsData* appendQuadsData) { | 85 AppendQuadsData* appendQuadsData) { |
87 const gfx::Rect& rect = visible_content_rect(); | 86 const gfx::Rect& rect = visible_content_rect(); |
88 gfx::Rect content_rect(content_bounds()); | 87 gfx::Rect content_rect(content_bounds()); |
89 | 88 |
90 SharedQuadState* sharedQuadState = | 89 SharedQuadState* sharedQuadState = |
91 quadSink->UseSharedQuadState(CreateSharedQuadState()); | 90 quadSink->UseSharedQuadState(CreateSharedQuadState()); |
92 AppendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 91 AppendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
93 | 92 |
94 bool clipped = false; | 93 bool clipped = false; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 *contents_scale_y = max_contents_scale; | 312 *contents_scale_y = max_contents_scale; |
314 *content_bounds = gfx::ToCeiledSize( | 313 *content_bounds = gfx::ToCeiledSize( |
315 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); | 314 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); |
316 } | 315 } |
317 | 316 |
318 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 317 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
319 return pile_->GetFlattenedPicture(); | 318 return pile_->GetFlattenedPicture(); |
320 } | 319 } |
321 | 320 |
322 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, | 321 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
323 gfx::Rect content_rect) { | 322 const gfx::Rect& content_rect, |
enne (OOO)
2013/03/27 16:16:27
No. Please stay consistent with passing rect by v
whunt
2013/03/27 17:42:02
I'll switch it back but the policy needs to be cha
enne (OOO)
2013/03/27 18:03:20
I'm aware of your doc. This is outside the scope
| |
323 const gfx::Rect& paint_rect) { | |
324 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) | 324 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
325 return scoped_refptr<Tile>(); | 325 return scoped_refptr<Tile>(); |
326 | 326 |
327 return make_scoped_refptr(new Tile( | 327 return make_scoped_refptr(new Tile( |
328 layer_tree_impl()->tile_manager(), | 328 layer_tree_impl()->tile_manager(), |
329 pile_.get(), | 329 pile_.get(), |
330 content_rect.size(), | 330 content_rect.size(), |
331 GL_RGBA, | 331 GL_RGBA, |
332 content_rect, | 332 content_rect, |
333 paint_rect, | |
333 contents_opaque() ? content_rect : gfx::Rect(), | 334 contents_opaque() ? content_rect : gfx::Rect(), |
334 tiling->contents_scale(), | 335 tiling->contents_scale(), |
335 id())); | 336 id())); |
336 } | 337 } |
337 | 338 |
338 void PictureLayerImpl::UpdatePile(Tile* tile) { | 339 void PictureLayerImpl::UpdatePile(Tile* tile) { |
339 tile->set_picture_pile(pile_); | 340 tile->set_picture_pile(pile_); |
340 } | 341 } |
341 | 342 |
343 const Region* PictureLayerImpl::GetInvalidation() { | |
344 return &invalidation_; | |
345 } | |
346 | |
347 const PictureLayerTiling* PictureLayerImpl::GetSibling( | |
348 const PictureLayerTiling* tiling) { | |
349 | |
350 const PictureLayerImpl* other_layer = layer_tree_impl()->IsActiveTree() ? | |
351 PendingTwin() : ActiveTwin(); | |
352 if (!other_layer) | |
353 return NULL; | |
354 for (size_t i = 0; i < other_layer->tilings_->num_tilings(); ++i) | |
355 if (other_layer->tilings_->tiling_at(i)->contents_scale() == | |
356 tiling->contents_scale()) | |
357 return other_layer->tilings_->tiling_at(i); | |
358 return NULL; | |
359 } | |
360 | |
342 gfx::Size PictureLayerImpl::CalculateTileSize( | 361 gfx::Size PictureLayerImpl::CalculateTileSize( |
343 gfx::Size current_tile_size, | 362 gfx::Size current_tile_size, |
344 gfx::Size content_bounds) { | 363 gfx::Size content_bounds) { |
345 if (is_mask_) { | 364 if (is_mask_) { |
346 int max_size = layer_tree_impl()->MaxTextureSize(); | 365 int max_size = layer_tree_impl()->MaxTextureSize(); |
347 return gfx::Size( | 366 return gfx::Size( |
348 std::min(max_size, content_bounds.width()), | 367 std::min(max_size, content_bounds.width()), |
349 std::min(max_size, content_bounds.height())); | 368 std::min(max_size, content_bounds.height())); |
350 } | 369 } |
351 | 370 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
801 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 820 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
802 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 821 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
803 LayerImpl::AsValueInto(state.get()); | 822 LayerImpl::AsValueInto(state.get()); |
804 | 823 |
805 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 824 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
806 state->Set("tilings", tilings_->AsValue().release()); | 825 state->Set("tilings", tilings_->AsValue().release()); |
807 return state.PassAs<base::Value>(); | 826 return state.PassAs<base::Value>(); |
808 } | 827 } |
809 | 828 |
810 } // namespace cc | 829 } // namespace cc |
OLD | NEW |