| 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 : picture_pile_analyzed(false), | 14 : picture_pile_analyzed(false), |
| 15 gpu_memmgr_stats_bin(NEVER_BIN), | 15 gpu_memmgr_stats_bin(NEVER_BIN), |
| 16 resolution(NON_IDEAL_RESOLUTION), | 16 resolution(NON_IDEAL_RESOLUTION), |
| 17 required_for_activation(false), | 17 required_for_activation(false), |
| 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::TileVersion::TileVersion() | 26 ManagedTileState::TileVersion::TileVersion() |
| 27 : mode_(RESOURCE_MODE), | 27 : mode_(RESOURCE_MODE), |
| 28 resource_id_(0), | 28 resource_id_(0), |
| 29 resource_format_(GL_RGBA), | 29 resource_format_(GL_RGBA), |
| 30 forced_upload_(false) { | 30 forced_upload_(false), |
| 31 raster_flags_(0) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 ManagedTileState::TileVersion::~TileVersion() { | 34 ManagedTileState::TileVersion::~TileVersion() { |
| 34 DCHECK(!resource_); | 35 DCHECK(!resource_); |
| 35 } | 36 } |
| 36 | 37 |
| 37 bool ManagedTileState::TileVersion::IsReadyToDraw() const { | 38 bool ManagedTileState::TileVersion::IsReadyToDraw() const { |
| 38 switch (mode_) { | 39 switch (mode_) { |
| 39 case RESOURCE_MODE: | 40 case RESOURCE_MODE: |
| 40 return resource_id_ && (resource_ || forced_upload_); | 41 return resource_id_ && (resource_ || forced_upload_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); | 73 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); |
| 73 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); | 74 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); |
| 74 state->SetBoolean("is_transparent", | 75 state->SetBoolean("is_transparent", |
| 75 picture_pile_analysis.is_solid_color && | 76 picture_pile_analysis.is_solid_color && |
| 76 !SkColorGetA(picture_pile_analysis.solid_color)); | 77 !SkColorGetA(picture_pile_analysis.solid_color)); |
| 77 return state.PassAs<base::Value>(); | 78 return state.PassAs<base::Value>(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace cc | 81 } // namespace cc |
| 81 | 82 |
| OLD | NEW |