[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 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 | |
[email protected] | 89e8267a | 2013-03-18 07:50:56 | [diff] [blame] | 5 | #include "cc/quads/tile_draw_quad.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | 1d99317 | 2012-10-18 18:15:04 | [diff] [blame] | 7 | #include "base/logging.h" |
ssid | 904ce3b | 2015-01-27 15:20:16 | [diff] [blame] | 8 | #include "base/trace_event/trace_event_argument.h" |
[email protected] | 3480672 | 2013-08-09 23:51:21 | [diff] [blame] | 9 | #include "base/values.h" |
[email protected] | 1d99317 | 2012-10-18 18:15:04 | [diff] [blame] | 10 | |
[email protected] | 9c88e56 | 2012-09-14 22:21:30 | [diff] [blame] | 11 | namespace cc { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 12 | |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 13 | TileDrawQuad::TileDrawQuad() { |
[email protected] | 9ee4d3a | 2013-03-27 17:43:16 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | TileDrawQuad::~TileDrawQuad() { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 17 | } |
| 18 | |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 19 | void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 20 | const gfx::Rect& rect, |
| 21 | const gfx::Rect& opaque_rect, |
[email protected] | 9bf06c7 | 2014-03-07 18:16:24 | [diff] [blame] | 22 | const gfx::Rect& visible_rect, |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 23 | unsigned resource_id, |
| 24 | const gfx::RectF& tex_coord_rect, |
[email protected] | 64348ea | 2014-01-29 22:58:26 | [diff] [blame] | 25 | const gfx::Size& texture_size, |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 26 | bool swizzle_contents, |
| 27 | bool nearest_neighbor) { |
[email protected] | 9bf06c7 | 2014-03-07 18:16:24 | [diff] [blame] | 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, |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 35 | swizzle_contents, |
| 36 | nearest_neighbor); |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 37 | resources.ids[kResourceIdIndex] = resource_id; |
| 38 | resources.count = 1; |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 42 | const gfx::Rect& rect, |
| 43 | const gfx::Rect& opaque_rect, |
| 44 | const gfx::Rect& visible_rect, |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 45 | bool needs_blending, |
| 46 | unsigned resource_id, |
| 47 | const gfx::RectF& tex_coord_rect, |
[email protected] | 64348ea | 2014-01-29 22:58:26 | [diff] [blame] | 48 | const gfx::Size& texture_size, |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 49 | bool swizzle_contents, |
| 50 | bool nearest_neighbor) { |
[email protected] | 9ee4d3a | 2013-03-27 17:43:16 | [diff] [blame] | 51 | ContentDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
| 52 | opaque_rect, visible_rect, needs_blending, |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 53 | tex_coord_rect, texture_size, swizzle_contents, |
| 54 | nearest_neighbor); |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 55 | resources.ids[kResourceIdIndex] = resource_id; |
| 56 | resources.count = 1; |
[email protected] | 0546963 | 2013-01-16 03:41:00 | [diff] [blame] | 57 | } |
| 58 | |
[email protected] | 9ee4d3a | 2013-03-27 17:43:16 | [diff] [blame] | 59 | const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) { |
[email protected] | c22418b | 2012-11-20 23:06:26 | [diff] [blame] | 60 | DCHECK(quad->material == DrawQuad::TILED_CONTENT); |
| 61 | return static_cast<const TileDrawQuad*>(quad); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 62 | } |
| 63 | |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 64 | void TileDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const { |
[email protected] | 3480672 | 2013-08-09 23:51:21 | [diff] [blame] | 65 | ContentDrawQuadBase::ExtendValue(value); |
vmpstr | 0eca2e8 | 2015-06-02 22:14:46 | [diff] [blame] | 66 | value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); |
[email protected] | 3480672 | 2013-08-09 23:51:21 | [diff] [blame] | 67 | } |
| 68 | |
[email protected] | bc5e77c | 2012-11-05 20:00:49 | [diff] [blame] | 69 | } // namespace cc |