blob: 02c4a1e25a5f9f175be4c66e389a8a914cda6564 [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"
ssid904ce3b2015-01-27 15:20:168#include "base/trace_event/trace_event_argument.h"
[email protected]34806722013-08-09 23:51:219#include "base/values.h"
[email protected]1d993172012-10-18 18:15:0410
[email protected]9c88e562012-09-14 22:21:3011namespace cc {
[email protected]94f206c12012-08-25 00:09:1412
vmpstr0eca2e82015-06-02 22:14:4613TileDrawQuad::TileDrawQuad() {
[email protected]9ee4d3a2013-03-27 17:43:1614}
15
16TileDrawQuad::~TileDrawQuad() {
[email protected]94f206c12012-08-25 00:09:1417}
18
[email protected]c22418b2012-11-20 23:06:2619void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
[email protected]0023fc72014-01-10 20:05:0620 const gfx::Rect& rect,
21 const gfx::Rect& opaque_rect,
[email protected]9bf06c72014-03-07 18:16:2422 const gfx::Rect& visible_rect,
[email protected]c22418b2012-11-20 23:06:2623 unsigned resource_id,
24 const gfx::RectF& tex_coord_rect,
[email protected]64348ea2014-01-29 22:58:2625 const gfx::Size& texture_size,
jackhou24229612014-12-13 23:41:0026 bool swizzle_contents,
27 bool nearest_neighbor) {
[email protected]9bf06c72014-03-07 18:16:2428 ContentDrawQuadBase::SetNew(shared_quad_state,
29 DrawQuad::TILED_CONTENT,
30 rect,
31 opaque_rect,
32 visible_rect,
33 tex_coord_rect,
34 texture_size,
jackhou24229612014-12-13 23:41:0035 swizzle_contents,
36 nearest_neighbor);
vmpstr0eca2e82015-06-02 22:14:4637 resources.ids[kResourceIdIndex] = resource_id;
38 resources.count = 1;
[email protected]c22418b2012-11-20 23:06:2639}
40
41void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
[email protected]0023fc72014-01-10 20:05:0642 const gfx::Rect& rect,
43 const gfx::Rect& opaque_rect,
44 const gfx::Rect& visible_rect,
[email protected]c22418b2012-11-20 23:06:2645 bool needs_blending,
46 unsigned resource_id,
47 const gfx::RectF& tex_coord_rect,
[email protected]64348ea2014-01-29 22:58:2648 const gfx::Size& texture_size,
jackhou24229612014-12-13 23:41:0049 bool swizzle_contents,
50 bool nearest_neighbor) {
[email protected]9ee4d3a2013-03-27 17:43:1651 ContentDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect,
52 opaque_rect, visible_rect, needs_blending,
jackhou24229612014-12-13 23:41:0053 tex_coord_rect, texture_size, swizzle_contents,
54 nearest_neighbor);
vmpstr0eca2e82015-06-02 22:14:4655 resources.ids[kResourceIdIndex] = resource_id;
56 resources.count = 1;
[email protected]05469632013-01-16 03:41:0057}
58
[email protected]9ee4d3a2013-03-27 17:43:1659const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) {
[email protected]c22418b2012-11-20 23:06:2660 DCHECK(quad->material == DrawQuad::TILED_CONTENT);
61 return static_cast<const TileDrawQuad*>(quad);
[email protected]94f206c12012-08-25 00:09:1462}
63
ssid911e40e2015-02-09 17:55:2064void TileDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const {
[email protected]34806722013-08-09 23:51:2165 ContentDrawQuadBase::ExtendValue(value);
vmpstr0eca2e82015-06-02 22:14:4666 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]);
[email protected]34806722013-08-09 23:51:2167}
68
[email protected]bc5e77c2012-11-05 20:00:4969} // namespace cc