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/debug/trace_event_argument.h"
8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "third_party/khronos/GLES2/gl2.h"
14 TileDrawQuad::TileDrawQuad()
18 TileDrawQuad::~TileDrawQuad() {
21 void TileDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
22 const gfx::Rect
& rect
,
23 const gfx::Rect
& opaque_rect
,
24 const gfx::Rect
& visible_rect
,
26 const gfx::RectF
& tex_coord_rect
,
27 const gfx::Size
& texture_size
,
28 bool swizzle_contents
) {
29 ContentDrawQuadBase::SetNew(shared_quad_state
,
30 DrawQuad::TILED_CONTENT
,
37 this->resource_id
= resource_id
;
40 void TileDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
41 const gfx::Rect
& rect
,
42 const gfx::Rect
& opaque_rect
,
43 const gfx::Rect
& visible_rect
,
46 const gfx::RectF
& tex_coord_rect
,
47 const gfx::Size
& texture_size
,
48 bool swizzle_contents
) {
49 ContentDrawQuadBase::SetAll(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
50 opaque_rect
, visible_rect
, needs_blending
,
51 tex_coord_rect
, texture_size
, swizzle_contents
);
52 this->resource_id
= resource_id
;
55 void TileDrawQuad::IterateResources(
56 const ResourceIteratorCallback
& callback
) {
57 resource_id
= callback
.Run(resource_id
);
60 const TileDrawQuad
* TileDrawQuad::MaterialCast(const DrawQuad
* quad
) {
61 DCHECK(quad
->material
== DrawQuad::TILED_CONTENT
);
62 return static_cast<const TileDrawQuad
*>(quad
);
65 void TileDrawQuad::ExtendValue(base::debug::TracedValue
* value
) const {
66 ContentDrawQuadBase::ExtendValue(value
);
67 value
->SetInteger("resource_id", resource_id
);