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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 gfx::Rect geometry_rect = iter.geometry_rect(); | 209 gfx::Rect geometry_rect = iter.geometry_rect(); |
210 if (!*iter || !iter->tile_version().IsReadyToDraw()) { | 210 if (!*iter || !iter->tile_version().IsReadyToDraw()) { |
211 if (DrawCheckerboardForMissingTiles()) { | 211 if (DrawCheckerboardForMissingTiles()) { |
212 // TODO(enne): Figure out how to show debug "invalidated checker" color | 212 // TODO(enne): Figure out how to show debug "invalidated checker" color |
213 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); | 213 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); |
214 SkColor color = DebugColors::DefaultCheckerboardColor(); | 214 SkColor color = DebugColors::DefaultCheckerboardColor(); |
215 quad->SetNew(shared_quad_state, geometry_rect, color); | 215 quad->SetNew(shared_quad_state, geometry_rect, color); |
216 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) | 216 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) |
217 append_quads_data->num_missing_tiles++; | 217 append_quads_data->num_missing_tiles++; |
218 } else { | 218 } else { |
219 SkColor color = background_color(); | 219 SkColor color = SafeOpaqueBackgroundColor(); |
220 // TODO(wangxianzhu): Change the next |if| condition once we support | |
221 // finer-grain opaqueness. Ensure with the following DCHECK. | |
222 DCHECK(contents_opaque() || VisibleContentOpaqueRegion().IsEmpty()); | |
223 if (SkColorGetA(color) != 255 && contents_opaque()) { | |
224 // If content is opaque, the occlusion tracker expects this layer to | |
225 // cover the background, so needs an opaque color. | |
226 for (const LayerImpl* layer = parent(); layer; | |
227 layer = layer->parent()) { | |
228 color = layer->background_color(); | |
229 if (SkColorGetA(color) == 255) | |
230 break; | |
231 } | |
232 if (SkColorGetA(color) != 255) | |
233 color = layer_tree_impl()->background_color(); | |
234 DCHECK_EQ(SkColorGetA(color), 255u); | |
235 } | |
236 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); | 220 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
237 quad->SetNew(shared_quad_state, geometry_rect, color, false); | 221 quad->SetNew(shared_quad_state, geometry_rect, color, false); |
238 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) | 222 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) |
239 append_quads_data->num_missing_tiles++; | 223 append_quads_data->num_missing_tiles++; |
240 } | 224 } |
241 | 225 |
242 append_quads_data->had_incomplete_tile = true; | 226 append_quads_data->had_incomplete_tile = true; |
243 continue; | 227 continue; |
244 } | 228 } |
245 | 229 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 state->Set("tilings", tilings_->AsValue().release()); | 1009 state->Set("tilings", tilings_->AsValue().release()); |
1026 state->Set("pictures", pile_->AsValue().release()); | 1010 state->Set("pictures", pile_->AsValue().release()); |
1027 state->Set("invalidation", invalidation_.AsValue().release()); | 1011 state->Set("invalidation", invalidation_.AsValue().release()); |
1028 } | 1012 } |
1029 | 1013 |
1030 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1014 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
1031 return tilings_->GPUMemoryUsageInBytes(); | 1015 return tilings_->GPUMemoryUsageInBytes(); |
1032 } | 1016 } |
1033 | 1017 |
1034 } // namespace cc | 1018 } // namespace cc |
OLD | NEW |