| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/render_pass_draw_quad.h" | 5 #include "cc/render_pass_draw_quad.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 RenderPassDrawQuad::RenderPassDrawQuad() | 9 RenderPassDrawQuad::RenderPassDrawQuad() |
| 10 : render_pass_id(RenderPass::Id(-1, -1)), | 10 : render_pass_id(RenderPass::Id(-1, -1)), |
| 11 is_replica(false), | 11 is_replica(false), |
| 12 mask_resource_id(-1) { | 12 mask_resource_id(-1) { |
| 13 } | 13 } |
| 14 | 14 |
| 15 RenderPassDrawQuad::~RenderPassDrawQuad() { |
| 16 } |
| 17 |
| 15 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Create() { | 18 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Create() { |
| 16 return make_scoped_ptr(new RenderPassDrawQuad); | 19 return make_scoped_ptr(new RenderPassDrawQuad); |
| 17 } | 20 } |
| 18 | 21 |
| 19 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Copy( | 22 scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::Copy( |
| 20 const SharedQuadState* copied_shared_quad_state, | 23 const SharedQuadState* copied_shared_quad_state, |
| 21 RenderPass::Id copied_render_pass_id) const { | 24 RenderPass::Id copied_render_pass_id) const { |
| 22 scoped_ptr<RenderPassDrawQuad> copy_quad(new RenderPassDrawQuad(*MaterialCast(
this))); | 25 scoped_ptr<RenderPassDrawQuad> copy_quad( |
| 26 new RenderPassDrawQuad(*MaterialCast(this))); |
| 23 copy_quad->shared_quad_state = copied_shared_quad_state; | 27 copy_quad->shared_quad_state = copied_shared_quad_state; |
| 24 copy_quad->render_pass_id = copied_render_pass_id; | 28 copy_quad->render_pass_id = copied_render_pass_id; |
| 25 return copy_quad.Pass(); | 29 return copy_quad.Pass(); |
| 26 } | 30 } |
| 27 | 31 |
| 28 void RenderPassDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 32 void RenderPassDrawQuad::SetNew( |
| 29 gfx::Rect rect, | 33 const SharedQuadState* shared_quad_state, |
| 30 RenderPass::Id render_pass_id, | 34 gfx::Rect rect, |
| 31 bool is_replica, | 35 RenderPass::Id render_pass_id, |
| 32 ResourceProvider::ResourceId mask_resource_id, | 36 bool is_replica, |
| 33 gfx::Rect contents_changed_since_last_frame, | 37 ResourceProvider::ResourceId mask_resource_id, |
| 34 gfx::RectF mask_uv_rect) { | 38 gfx::Rect contents_changed_since_last_frame, |
| 39 gfx::RectF mask_uv_rect, |
| 40 const WebKit::WebFilterOperations& filters, |
| 41 skia::RefPtr<SkImageFilter> filter, |
| 42 const WebKit::WebFilterOperations& background_filters) { |
| 35 DCHECK(render_pass_id.layer_id > 0); | 43 DCHECK(render_pass_id.layer_id > 0); |
| 36 DCHECK(render_pass_id.index >= 0); | 44 DCHECK(render_pass_id.index >= 0); |
| 37 | 45 |
| 38 gfx::Rect opaque_rect; | 46 gfx::Rect opaque_rect; |
| 39 gfx::Rect visible_rect = rect; | 47 gfx::Rect visible_rect = rect; |
| 40 bool needs_blending = false; | 48 bool needs_blending = false; |
| 41 DrawQuad::SetAll(shared_quad_state, DrawQuad::RENDER_PASS, rect, opaque_rect, | 49 SetAll(shared_quad_state, rect, opaque_rect, visible_rect, needs_blending, |
| 42 visible_rect, needs_blending); | 50 render_pass_id, is_replica, mask_resource_id, |
| 43 this->render_pass_id = render_pass_id; | 51 contents_changed_since_last_frame, mask_uv_rect, filters, filter, |
| 44 this->is_replica = is_replica; | 52 background_filters); |
| 45 this->mask_resource_id = mask_resource_id; | |
| 46 this->contents_changed_since_last_frame = contents_changed_since_last_frame; | |
| 47 this->mask_uv_rect = mask_uv_rect; | |
| 48 } | 53 } |
| 49 | 54 |
| 50 void RenderPassDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 55 void RenderPassDrawQuad::SetAll( |
| 51 gfx::Rect rect, | 56 const SharedQuadState* shared_quad_state, |
| 52 gfx::Rect opaque_rect, | 57 gfx::Rect rect, |
| 53 gfx::Rect visible_rect, | 58 gfx::Rect opaque_rect, |
| 54 bool needs_blending, | 59 gfx::Rect visible_rect, |
| 55 RenderPass::Id render_pass_id, | 60 bool needs_blending, |
| 56 bool is_replica, | 61 RenderPass::Id render_pass_id, |
| 57 ResourceProvider::ResourceId mask_resource_id, | 62 bool is_replica, |
| 58 gfx::Rect contents_changed_since_last_frame, | 63 ResourceProvider::ResourceId mask_resource_id, |
| 59 gfx::RectF mask_uv_rect) { | 64 gfx::Rect contents_changed_since_last_frame, |
| 65 gfx::RectF mask_uv_rect, |
| 66 const WebKit::WebFilterOperations& filters, |
| 67 skia::RefPtr<SkImageFilter> filter, |
| 68 const WebKit::WebFilterOperations& background_filters) { |
| 60 DCHECK(render_pass_id.layer_id > 0); | 69 DCHECK(render_pass_id.layer_id > 0); |
| 61 DCHECK(render_pass_id.index >= 0); | 70 DCHECK(render_pass_id.index >= 0); |
| 62 | 71 |
| 63 DrawQuad::SetAll(shared_quad_state, DrawQuad::RENDER_PASS, rect, opaque_rect, | 72 DrawQuad::SetAll(shared_quad_state, DrawQuad::RENDER_PASS, rect, opaque_rect, |
| 64 visible_rect, needs_blending); | 73 visible_rect, needs_blending); |
| 65 this->render_pass_id = render_pass_id; | 74 this->render_pass_id = render_pass_id; |
| 66 this->is_replica = is_replica; | 75 this->is_replica = is_replica; |
| 67 this->mask_resource_id = mask_resource_id; | 76 this->mask_resource_id = mask_resource_id; |
| 68 this->contents_changed_since_last_frame = contents_changed_since_last_frame; | 77 this->contents_changed_since_last_frame = contents_changed_since_last_frame; |
| 69 this->mask_uv_rect = mask_uv_rect; | 78 this->mask_uv_rect = mask_uv_rect; |
| 79 this->filters = filters; |
| 80 this->filter = filter; |
| 81 this->background_filters = background_filters; |
| 70 } | 82 } |
| 71 | 83 |
| 72 const RenderPassDrawQuad* RenderPassDrawQuad::MaterialCast( | 84 const RenderPassDrawQuad* RenderPassDrawQuad::MaterialCast( |
| 73 const DrawQuad* quad) { | 85 const DrawQuad* quad) { |
| 74 DCHECK(quad->material == DrawQuad::RENDER_PASS); | 86 DCHECK(quad->material == DrawQuad::RENDER_PASS); |
| 75 return static_cast<const RenderPassDrawQuad*>(quad); | 87 return static_cast<const RenderPassDrawQuad*>(quad); |
| 76 } | 88 } |
| 77 | 89 |
| 78 } // namespace cc | 90 } // namespace cc |
| OLD | NEW |