1 // Copyright 2012 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/quads/tile_draw_quad.h"
7 #include "base/logging.h"
8 #include "base/trace_event/trace_event_argument.h"
9 #include "base/values.h"
13 TileDrawQuad::TileDrawQuad()
17 TileDrawQuad::~TileDrawQuad() {
20 void TileDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
21 const gfx::Rect
& rect
,
22 const gfx::Rect
& opaque_rect
,
23 const gfx::Rect
& visible_rect
,
25 const gfx::RectF
& tex_coord_rect
,
26 const gfx::Size
& texture_size
,
27 bool swizzle_contents
,
28 bool nearest_neighbor
) {
29 ContentDrawQuadBase::SetNew(shared_quad_state
,
30 DrawQuad::TILED_CONTENT
,
38 this->resource_id
= resource_id
;
41 void TileDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
42 const gfx::Rect
& rect
,
43 const gfx::Rect
& opaque_rect
,
44 const gfx::Rect
& visible_rect
,
47 const gfx::RectF
& tex_coord_rect
,
48 const gfx::Size
& texture_size
,
49 bool swizzle_contents
,
50 bool nearest_neighbor
) {
51 ContentDrawQuadBase::SetAll(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
52 opaque_rect
, visible_rect
, needs_blending
,
53 tex_coord_rect
, texture_size
, swizzle_contents
,
55 this->resource_id
= resource_id
;
58 void TileDrawQuad::IterateResources(
59 const ResourceIteratorCallback
& callback
) {
60 resource_id
= callback
.Run(resource_id
);
63 const TileDrawQuad
* TileDrawQuad::MaterialCast(const DrawQuad
* quad
) {
64 DCHECK(quad
->material
== DrawQuad::TILED_CONTENT
);
65 return static_cast<const TileDrawQuad
*>(quad
);
68 void TileDrawQuad::ExtendValue(base::trace_event::TracedValue
* value
) const {
69 ContentDrawQuadBase::ExtendValue(value
);
70 value
->SetInteger("resource_id", resource_id
);