| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/quads/tile_draw_quad.h" | 5 #include "cc/quads/tile_draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 TileDrawQuad::TileDrawQuad() | 12 TileDrawQuad::TileDrawQuad() |
| 13 : resource_id(0), | 13 : resource_id(0) { |
| 14 swizzle_contents(false) { | 14 } |
| 15 |
| 16 TileDrawQuad::~TileDrawQuad() { |
| 15 } | 17 } |
| 16 | 18 |
| 17 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { | 19 scoped_ptr<TileDrawQuad> TileDrawQuad::Create() { |
| 18 return make_scoped_ptr(new TileDrawQuad); | 20 return make_scoped_ptr(new TileDrawQuad); |
| 19 } | 21 } |
| 20 | 22 |
| 21 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 23 void TileDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 22 gfx::Rect rect, | 24 const gfx::Rect& rect, |
| 23 gfx::Rect opaque_rect, | 25 const gfx::Rect& opaque_rect, |
| 24 unsigned resource_id, | 26 unsigned resource_id, |
| 25 const gfx::RectF& tex_coord_rect, | 27 const gfx::RectF& tex_coord_rect, |
| 26 gfx::Size texture_size, | 28 const gfx::Size& texture_size, |
| 27 bool swizzle_contents) { | 29 bool swizzle_contents) { |
| 28 gfx::Rect visible_rect = rect; | 30 TileDrawQuadBase::SetNew(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
| 29 bool needs_blending = false; | 31 opaque_rect, tex_coord_rect, texture_size, |
| 30 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 32 swizzle_contents); |
| 31 opaque_rect, visible_rect, needs_blending); | |
| 32 this->resource_id = resource_id; | 33 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; | |
| 36 } | 34 } |
| 37 | 35 |
| 38 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 36 void TileDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 39 gfx::Rect rect, | 37 const gfx::Rect& rect, |
| 40 gfx::Rect opaque_rect, | 38 const gfx::Rect& opaque_rect, |
| 41 gfx::Rect visible_rect, | 39 const gfx::Rect& visible_rect, |
| 42 bool needs_blending, | 40 bool needs_blending, |
| 43 unsigned resource_id, | 41 unsigned resource_id, |
| 44 const gfx::RectF& tex_coord_rect, | 42 const gfx::RectF& tex_coord_rect, |
| 45 gfx::Size texture_size, | 43 const gfx::Size& texture_size, |
| 46 bool swizzle_contents) { | 44 bool swizzle_contents) { |
| 47 DrawQuad::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, | 45 TileDrawQuadBase::SetAll(shared_quad_state, DrawQuad::TILED_CONTENT, rect, |
| 48 opaque_rect, visible_rect, needs_blending); | 46 opaque_rect, visible_rect, needs_blending, |
| 47 tex_coord_rect, texture_size, swizzle_contents); |
| 49 this->resource_id = resource_id; | 48 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; | |
| 53 } | 49 } |
| 54 | 50 |
| 55 void TileDrawQuad::IterateResources( | 51 void TileDrawQuad::IterateResources( |
| 56 const ResourceIteratorCallback& callback) { | 52 const ResourceIteratorCallback& callback) { |
| 57 resource_id = callback.Run(resource_id); | 53 resource_id = callback.Run(resource_id); |
| 58 } | 54 } |
| 59 | 55 |
| 60 const TileDrawQuad* TileDrawQuad::MaterialCast( | 56 const TileDrawQuad* TileDrawQuad::MaterialCast(const DrawQuad* quad) { |
| 61 const DrawQuad* quad) { | |
| 62 DCHECK(quad->material == DrawQuad::TILED_CONTENT); | 57 DCHECK(quad->material == DrawQuad::TILED_CONTENT); |
| 63 return static_cast<const TileDrawQuad*>(quad); | 58 return static_cast<const TileDrawQuad*>(quad); |
| 64 } | 59 } |
| 65 | 60 |
| 66 } // namespace cc | 61 } // namespace cc |
| OLD | NEW |