Re-land: C++ readability review
[chromium-blink-merge.git] / cc / resources / tile_draw_info.cc
blobe75ea59ef84526f66498ca3688cbf457b34fb015
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
3 // found in the LICENSE file.
5 #include "cc/resources/tile_draw_info.h"
7 #include "cc/base/math_util.h"
9 namespace cc {
11 TileDrawInfo::TileDrawInfo()
12 : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) {
15 TileDrawInfo::~TileDrawInfo() {
16 DCHECK(!resource_);
19 bool TileDrawInfo::IsReadyToDraw() const {
20 switch (mode_) {
21 case RESOURCE_MODE:
22 return !!resource_;
23 case SOLID_COLOR_MODE:
24 case OOM_MODE:
25 return true;
27 NOTREACHED();
28 return false;
31 void TileDrawInfo::AsValueInto(base::trace_event::TracedValue* state) const {
32 state->SetBoolean("is_solid_color", mode_ == SOLID_COLOR_MODE);
33 state->SetBoolean("is_transparent",
34 mode_ == SOLID_COLOR_MODE && !SkColorGetA(solid_color_));
37 } // namespace cc