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