tile_draw_quad.cc revision 116680a4aac90f2aa7413d9095a592090648e557
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. 4 5#include "cc/quads/tile_draw_quad.h" 6 7#include "base/logging.h" 8#include "base/values.h" 9#include "third_party/khronos/GLES2/gl2.h" 10 11namespace cc { 12 13TileDrawQuad::TileDrawQuad() 14 : resource_id(0) { 15} 16 17TileDrawQuad::~TileDrawQuad() { 18} 19 20void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 21 const gfx::Rect& rect, 22 const gfx::Rect& opaque_rect, 23 const gfx::Rect& visible_rect, 24 unsigned resource_id, 25 const gfx::RectF& tex_coord_rect, 26 const gfx::Size& texture_size, 27 bool swizzle_contents) { 28 ContentDrawQuadBase::SetNew(shared_quad_state, 29 DrawQuad::TILED_CONTENT, 30 rect, 31 opaque_rect, 32 visible_rect, 33 tex_coord_rect, 34 texture_size, 35 swizzle_contents); 36 this->resource_id = resource_id; 37} 38 39void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 40 const gfx::Rect& rect, 41 const gfx::Rect& opaque_rect, 42 const gfx::Rect& visible_rect, 43 bool needs_blending, 44 unsigned resource_id, 45 const gfx::RectF& tex_coord_rect, 46 const gfx::Size& texture_size, 47 bool swizzle_contents) { 48 ContentDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, 49 opaque_rect, visible_rect, needs_blending, 50 tex_coord_rect, texture_size, swizzle_contents); 51 this->resource_id = resource_id; 52} 53 54void TileDrawQuad::IterateResources( 55 const ResourceIteratorCallback& callback) { 56 resource_id = callback.Run(resource_id); 57} 58 59const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) { 60 DCHECK(quad->material == DrawQuad::TILED_CONTENT); 61 return static_cast<const TileDrawQuad*>(quad); 62} 63 64void TileDrawQuad::ExtendValue(base::DictionaryValue* value) const { 65 ContentDrawQuadBase::ExtendValue(value); 66 value->SetInteger("resource_id", resource_id); 67} 68 69} // namespace cc 70