| 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 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ManagedTileState::ManagedTileState() | 47 ManagedTileState::ManagedTileState() |
| 48 : raster_mode(LOW_QUALITY_RASTER_MODE), | 48 : raster_mode(LOW_QUALITY_RASTER_MODE), |
| 49 bin(NEVER_BIN), | 49 bin(NEVER_BIN), |
| 50 resolution(NON_IDEAL_RESOLUTION), | 50 resolution(NON_IDEAL_RESOLUTION), |
| 51 required_for_activation(false), | 51 required_for_activation(false), |
| 52 priority_bin(TilePriority::EVENTUALLY), | 52 priority_bin(TilePriority::EVENTUALLY), |
| 53 distance_to_visible(std::numeric_limits<float>::infinity()), | 53 distance_to_visible(std::numeric_limits<float>::infinity()), |
| 54 visible_and_ready_to_draw(false), | 54 visible_and_ready_to_draw(false), |
| 55 scheduled_priority(0) {} | 55 scheduled_priority(0) {} |
| 56 | 56 |
| 57 ManagedTileState::TileVersion::TileVersion() : mode_(RESOURCE_MODE) { | 57 ManagedTileState::TileVersion::TileVersion() |
| 58 : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) { |
| 58 } | 59 } |
| 59 | 60 |
| 60 ManagedTileState::TileVersion::~TileVersion() { DCHECK(!resource_); } | 61 ManagedTileState::TileVersion::~TileVersion() { DCHECK(!resource_); } |
| 61 | 62 |
| 62 bool ManagedTileState::TileVersion::IsReadyToDraw() const { | 63 bool ManagedTileState::TileVersion::IsReadyToDraw() const { |
| 63 switch (mode_) { | 64 switch (mode_) { |
| 64 case RESOURCE_MODE: | 65 case RESOURCE_MODE: |
| 65 return !!resource_; | 66 return !!resource_; |
| 66 case SOLID_COLOR_MODE: | 67 case SOLID_COLOR_MODE: |
| 67 case PICTURE_PILE_MODE: | 68 case PICTURE_PILE_MODE: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); | 104 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); |
| 104 state->SetBoolean( | 105 state->SetBoolean( |
| 105 "is_transparent", | 106 "is_transparent", |
| 106 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && | 107 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
| 107 !SkColorGetA(tile_versions[raster_mode].solid_color_)); | 108 !SkColorGetA(tile_versions[raster_mode].solid_color_)); |
| 108 state->SetInteger("scheduled_priority", scheduled_priority); | 109 state->SetInteger("scheduled_priority", scheduled_priority); |
| 109 return state.PassAs<base::Value>(); | 110 return state.PassAs<base::Value>(); |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace cc | 113 } // namespace cc |
| OLD | NEW |