Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2115)

Unified Diff: cc/resources/tile_draw_info.cc

Issue 793573006: Refactoring for merging ManagedTileState into Tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a nit Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/tile_draw_info.h ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_draw_info.cc
diff --git a/cc/resources/tile_draw_info.cc b/cc/resources/tile_draw_info.cc
new file mode 100644
index 0000000000000000000000000000000000000000..518a74b82ada89c5618fbf1cd4f4589b44da29a7
--- /dev/null
+++ b/cc/resources/tile_draw_info.cc
@@ -0,0 +1,37 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/resources/tile_draw_info.h"
+
+#include "cc/base/math_util.h"
+
+namespace cc {
+
+TileDrawInfo::TileDrawInfo()
+ : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) {
+}
+
+TileDrawInfo::~TileDrawInfo() {
+ DCHECK(!resource_);
+}
+
+bool TileDrawInfo::IsReadyToDraw() const {
+ switch (mode_) {
+ case RESOURCE_MODE:
+ return !!resource_;
+ case SOLID_COLOR_MODE:
+ case PICTURE_PILE_MODE:
+ return true;
+ }
+ NOTREACHED();
+ return false;
+}
+
+void TileDrawInfo::AsValueInto(base::debug::TracedValue* state) const {
+ state->SetBoolean("is_solid_color", mode_ == SOLID_COLOR_MODE);
+ state->SetBoolean("is_transparent",
+ mode_ == SOLID_COLOR_MODE && !SkColorGetA(solid_color_));
+}
+
+} // namespace cc
« no previous file with comments | « cc/resources/tile_draw_info.h ('k') | cc/resources/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698