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/values.h"
9 #include "third_party/khronos/GLES2/gl2.h"
13 TileDrawQuad::TileDrawQuad()
17 TileDrawQuad::~TileDrawQuad() {
20 scoped_ptr
<TileDrawQuad
> TileDrawQuad::Create() {
21 return make_scoped_ptr(new TileDrawQuad
);
24 void TileDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
26 gfx::Rect opaque_rect
,
28 const gfx::RectF
& tex_coord_rect
,
29 gfx::Size texture_size
,
30 bool swizzle_contents
) {
31 ContentDrawQuadBase::SetNew(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
32 opaque_rect
, tex_coord_rect
, texture_size
,
34 this->resource_id
= resource_id
;
37 void TileDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
39 gfx::Rect opaque_rect
,
40 gfx::Rect visible_rect
,
43 const gfx::RectF
& tex_coord_rect
,
44 gfx::Size texture_size
,
45 bool swizzle_contents
) {
46 ContentDrawQuadBase::SetAll(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
47 opaque_rect
, visible_rect
, needs_blending
,
48 tex_coord_rect
, texture_size
, swizzle_contents
);
49 this->resource_id
= resource_id
;
52 void TileDrawQuad::IterateResources(
53 const ResourceIteratorCallback
& callback
) {
54 resource_id
= callback
.Run(resource_id
);
57 const TileDrawQuad
* TileDrawQuad::MaterialCast(const DrawQuad
* quad
) {
58 DCHECK(quad
->material
== DrawQuad::TILED_CONTENT
);
59 return static_cast<const TileDrawQuad
*>(quad
);
62 void TileDrawQuad::ExtendValue(base::DictionaryValue
* value
) const {
63 ContentDrawQuadBase::ExtendValue(value
);
64 value
->SetInteger("resource_id", resource_id
);