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
,
25 const gfx::Rect
& rect
,
26 const gfx::Rect
& opaque_rect
,
27 const gfx::Rect
& visible_rect
,
29 const gfx::RectF
& tex_coord_rect
,
30 const gfx::Size
& texture_size
,
31 bool swizzle_contents
) {
32 ContentDrawQuadBase::SetNew(shared_quad_state
,
33 DrawQuad::TILED_CONTENT
,
40 this->resource_id
= resource_id
;
43 void TileDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
44 const gfx::Rect
& rect
,
45 const gfx::Rect
& opaque_rect
,
46 const gfx::Rect
& visible_rect
,
49 const gfx::RectF
& tex_coord_rect
,
50 const gfx::Size
& texture_size
,
51 bool swizzle_contents
) {
52 ContentDrawQuadBase::SetAll(shared_quad_state
, DrawQuad::TILED_CONTENT
, rect
,
53 opaque_rect
, visible_rect
, needs_blending
,
54 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::DictionaryValue
* value
) const {
69 ContentDrawQuadBase::ExtendValue(value
);
70 value
->SetInteger("resource_id", resource_id
);