1 // Copyright 2013 The Chromium Authors
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/tiles/tile_draw_info.h"
9 #include "base/metrics/histogram_macros.h"
10 #include "cc/base/math_util.h"
14 TileDrawInfo::TileDrawInfo() = default;
15 TileDrawInfo::~TileDrawInfo() {
19 void TileDrawInfo::AsValueInto(base::trace_event::TracedValue* state) const {
20 state->SetBoolean("is_solid_color", mode_ == SOLID_COLOR_MODE);
21 state->SetBoolean("is_transparent",
22 mode_ == SOLID_COLOR_MODE && !solid_color_.isOpaque());
25 void TileDrawInfo::SetResource(ResourcePool::InUsePoolResource resource,
26 bool resource_is_checker_imaged,
27 bool is_premultiplied) {
31 mode_ = RESOURCE_MODE;
32 is_resource_ready_to_draw_ = false;
33 resource_is_checker_imaged_ = resource_is_checker_imaged;
34 is_premultiplied_ = is_premultiplied;
35 resource_ = std::move(resource);
38 const ResourcePool::InUsePoolResource& TileDrawInfo::GetResource() const {
39 DCHECK_EQ(mode_, RESOURCE_MODE);
44 ResourcePool::InUsePoolResource TileDrawInfo::TakeResource() {
45 DCHECK_EQ(mode_, RESOURCE_MODE);
47 is_resource_ready_to_draw_ = false;
48 resource_is_checker_imaged_ = false;
49 is_premultiplied_ = false;
50 return std::move(resource_);