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 "third_party/khronos/GLES2/gl2.h"
12 TileDrawQuad::TileDrawQuad()
16 TileDrawQuad::~TileDrawQuad() {
19 scoped_ptr
<TileDrawQuad
> TileDrawQuad::Create() {
20 return make_scoped_ptr(new TileDrawQuad
);
23 void TileDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
25 gfx::Rect opaque_rect
,
27 const gfx::RectF
& tex_coord_rect
,
28 gfx::Size texture_size
,
29 bool swizzle_contents
) {
30 ContentDrawQuadBase::SetNew(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
31 opaque_rect
, tex_coord_rect
, texture_size
,
33 this->resource_id
= resource_id
;
36 void TileDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
38 gfx::Rect opaque_rect
,
39 gfx::Rect visible_rect
,
42 const gfx::RectF
& tex_coord_rect
,
43 gfx::Size texture_size
,
44 bool swizzle_contents
) {
45 ContentDrawQuadBase::SetAll(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
46 opaque_rect
, visible_rect
, needs_blending
,
47 tex_coord_rect
, texture_size
, swizzle_contents
);
48 this->resource_id
= resource_id
;
51 void TileDrawQuad::IterateResources(
52 const ResourceIteratorCallback
& callback
) {
53 resource_id
= callback
.Run(resource_id
);
56 const TileDrawQuad
* TileDrawQuad::MaterialCast(const DrawQuad
* quad
) {
57 DCHECK(quad
->material
== DrawQuad::TILED_CONTENT
);
58 return static_cast<const TileDrawQuad
*>(quad
);