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/resources/managed_tile_state.h" | 5 #include "cc/resources/managed_tile_state.h" |
6 | 6 |
7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 ManagedTileState::ManagedTileState() | 11 ManagedTileState::ManagedTileState() |
12 : can_use_gpu_memory(false), | 12 : can_use_gpu_memory(false), |
13 need_to_gather_pixel_refs(true), | 13 need_to_gather_pixel_refs(true), |
14 raster_state(IDLE_STATE), | 14 raster_state(IDLE_STATE), |
15 picture_pile_analyzed(false), | 15 picture_pile_analyzed(false), |
16 gpu_memmgr_stats_bin(NEVER_BIN), | 16 gpu_memmgr_stats_bin(NEVER_BIN), |
17 resolution(NON_IDEAL_RESOLUTION), | 17 resolution(NON_IDEAL_RESOLUTION), |
18 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 18 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
19 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { | 19 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { |
20 for (int i = 0; i < NUM_TREES; ++i) { | 20 for (int i = 0; i < NUM_TREES; ++i) { |
21 tree_bin[i] = NEVER_BIN; | 21 tree_bin[i] = NEVER_BIN; |
22 bin[i] = NEVER_BIN; | 22 bin[i] = NEVER_BIN; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 ManagedTileState::DrawingInfo::DrawingInfo() | 26 ManagedTileState::DrawingInfo::DrawingInfo() |
27 : mode_(TEXTURE_MODE), | 27 : mode_(RESOURCE_MODE), |
28 resource_is_being_initialized_(false), | 28 resource_is_being_initialized_(false), |
29 can_be_freed_(true), | 29 can_be_freed_(true), |
30 contents_swizzled_(false) { | 30 contents_swizzled_(false) { |
31 } | 31 } |
32 | 32 |
33 ManagedTileState::DrawingInfo::~DrawingInfo() { | 33 ManagedTileState::DrawingInfo::~DrawingInfo() { |
34 } | 34 } |
35 | 35 |
36 bool ManagedTileState::DrawingInfo::IsReadyToDraw() const { | 36 bool ManagedTileState::DrawingInfo::IsReadyToDraw() const { |
37 switch (mode_) { | 37 switch (mode_) { |
38 case TEXTURE_MODE: | 38 case RESOURCE_MODE: |
39 return resource_ && | 39 return resource_ && |
40 !resource_is_being_initialized_ && | 40 !resource_is_being_initialized_ && |
41 resource_->id(); | 41 resource_->id(); |
42 case SOLID_COLOR_MODE: | 42 case SOLID_COLOR_MODE: |
43 case TRANSPARENT_MODE: | 43 case TRANSPARENT_MODE: |
44 case PICTURE_PILE_MODE: | 44 case PICTURE_PILE_MODE: |
45 return true; | 45 return true; |
46 default: | 46 default: |
47 NOTREACHED(); | 47 NOTREACHED(); |
48 return false; | 48 return false; |
(...skipping 25 matching lines...) Expand all Loading... |
74 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); | 74 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); |
75 state->SetBoolean("is_cheap_to_raster", | 75 state->SetBoolean("is_cheap_to_raster", |
76 picture_pile_analysis.is_cheap_to_raster); | 76 picture_pile_analysis.is_cheap_to_raster); |
77 state->SetBoolean("is_transparent", picture_pile_analysis.is_transparent); | 77 state->SetBoolean("is_transparent", picture_pile_analysis.is_transparent); |
78 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); | 78 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); |
79 return state.PassAs<base::Value>(); | 79 return state.PassAs<base::Value>(); |
80 } | 80 } |
81 | 81 |
82 } // namespace cc | 82 } // namespace cc |
83 | 83 |
OLD | NEW |