blob: 04c473834cba42f72d7d85e6221f832182948551 [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// 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
[email protected]89e8267a2013-03-18 07:50:565#include "cc/quads/tile_draw_quad.h"
[email protected]94f206c12012-08-25 00:09:146
[email protected]1d993172012-10-18 18:15:047#include "base/logging.h"
[email protected]d9c28522012-10-18 23:35:438#include "third_party/khronos/GLES2/gl2.h"
[email protected]1d993172012-10-18 18:15:049
[email protected]9c88e562012-09-14 22:21:3010namespace cc {
[email protected]94f206c12012-08-25 00:09:1411
[email protected]c22418b2012-11-20 23:06:2612TileDrawQuad::TileDrawQuad()
13 : resource_id(0),
[email protected]f902bf92013-03-04 18:33:2714 swizzle_contents(false) {
[email protected]94f206c12012-08-25 00:09:1415}
16
[email protected]c22418b2012-11-20 23:06:2617scoped_ptr<TileDrawQuad> TileDrawQuad::Create() {
18 return make_scoped_ptr(new TileDrawQuad);
[email protected]94f206c12012-08-25 00:09:1419}
20
[email protected]c22418b2012-11-20 23:06:2621void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 gfx::Rect rect,
23 gfx::Rect opaque_rect,
24 unsigned resource_id,
25 const gfx::RectF& tex_coord_rect,
26 gfx::Size texture_size,
[email protected]f902bf92013-03-04 18:33:2727 bool swizzle_contents) {
[email protected]c22418b2012-11-20 23:06:2628 gfx::Rect visible_rect = rect;
29 bool needs_blending = false;
30 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect,
31 opaque_rect, visible_rect, needs_blending);
32 this->resource_id = resource_id;
33 this->tex_coord_rect = tex_coord_rect;
34 this->texture_size = texture_size;
35 this->swizzle_contents = swizzle_contents;
[email protected]c22418b2012-11-20 23:06:2636}
37
38void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
39 gfx::Rect rect,
40 gfx::Rect opaque_rect,
41 gfx::Rect visible_rect,
42 bool needs_blending,
43 unsigned resource_id,
44 const gfx::RectF& tex_coord_rect,
45 gfx::Size texture_size,
[email protected]f902bf92013-03-04 18:33:2746 bool swizzle_contents) {
[email protected]c22418b2012-11-20 23:06:2647 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect,
48 opaque_rect, visible_rect, needs_blending);
49 this->resource_id = resource_id;
50 this->tex_coord_rect = tex_coord_rect;
51 this->texture_size = texture_size;
52 this->swizzle_contents = swizzle_contents;
[email protected]c22418b2012-11-20 23:06:2653}
54
[email protected]3c0a63c22013-03-01 03:56:5855void TileDrawQuad::IterateResources(
56 const ResourceIteratorCallback& callback) {
57 resource_id = callback.Run(resource_id);
[email protected]05469632013-01-16 03:41:0058}
59
[email protected]c22418b2012-11-20 23:06:2660const TileDrawQuad* TileDrawQuad::MaterialCast(
61 const DrawQuad* quad) {
62 DCHECK(quad->material == DrawQuad::TILED_CONTENT);
63 return static_cast<const TileDrawQuad*>(quad);
[email protected]94f206c12012-08-25 00:09:1464}
65
[email protected]bc5e77c2012-11-05 20:00:4966} // namespace cc