| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content_draw_quad_base.h" | 5 #include "cc/quads/content_draw_quad_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 ContentDrawQuadBase::ContentDrawQuadBase() | 14 ContentDrawQuadBase::ContentDrawQuadBase() |
| 15 : swizzle_contents(false) { | 15 : swizzle_contents(false), nearest_neighbor(false), allow_overlay(false) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 ContentDrawQuadBase::~ContentDrawQuadBase() { | 18 ContentDrawQuadBase::~ContentDrawQuadBase() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void ContentDrawQuadBase::SetNew(const SharedQuadState* shared_quad_state, | 21 void ContentDrawQuadBase::SetNew(const SharedQuadState* shared_quad_state, |
| 22 DrawQuad::Material material, | 22 DrawQuad::Material material, |
| 23 const gfx::Rect& rect, | 23 const gfx::Rect& rect, |
| 24 const gfx::Rect& opaque_rect, | 24 const gfx::Rect& opaque_rect, |
| 25 const gfx::Rect& visible_rect, | 25 const gfx::Rect& visible_rect, |
| 26 const gfx::RectF& tex_coord_rect, | 26 const gfx::RectF& tex_coord_rect, |
| 27 const gfx::Size& texture_size, | 27 const gfx::Size& texture_size, |
| 28 bool swizzle_contents, | 28 bool swizzle_contents, |
| 29 bool nearest_neighbor) { | 29 bool nearest_neighbor, |
| 30 bool allow_overlay) { |
| 30 bool needs_blending = false; | 31 bool needs_blending = false; |
| 31 DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect, | 32 DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect, |
| 32 visible_rect, needs_blending); | 33 visible_rect, needs_blending); |
| 33 this->tex_coord_rect = tex_coord_rect; | 34 this->tex_coord_rect = tex_coord_rect; |
| 34 this->texture_size = texture_size; | 35 this->texture_size = texture_size; |
| 35 this->swizzle_contents = swizzle_contents; | 36 this->swizzle_contents = swizzle_contents; |
| 36 this->nearest_neighbor = nearest_neighbor; | 37 this->nearest_neighbor = nearest_neighbor; |
| 38 this->allow_overlay = allow_overlay; |
| 37 } | 39 } |
| 38 | 40 |
| 39 void ContentDrawQuadBase::SetAll(const SharedQuadState* shared_quad_state, | 41 void ContentDrawQuadBase::SetAll(const SharedQuadState* shared_quad_state, |
| 40 DrawQuad::Material material, | 42 DrawQuad::Material material, |
| 41 const gfx::Rect& rect, | 43 const gfx::Rect& rect, |
| 42 const gfx::Rect& opaque_rect, | 44 const gfx::Rect& opaque_rect, |
| 43 const gfx::Rect& visible_rect, | 45 const gfx::Rect& visible_rect, |
| 44 bool needs_blending, | 46 bool needs_blending, |
| 45 const gfx::RectF& tex_coord_rect, | 47 const gfx::RectF& tex_coord_rect, |
| 46 const gfx::Size& texture_size, | 48 const gfx::Size& texture_size, |
| 47 bool swizzle_contents, | 49 bool swizzle_contents, |
| 48 bool nearest_neighbor) { | 50 bool nearest_neighbor, |
| 51 bool allow_overlay) { |
| 49 DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect, | 52 DrawQuad::SetAll(shared_quad_state, material, rect, opaque_rect, |
| 50 visible_rect, needs_blending); | 53 visible_rect, needs_blending); |
| 51 this->tex_coord_rect = tex_coord_rect; | 54 this->tex_coord_rect = tex_coord_rect; |
| 52 this->texture_size = texture_size; | 55 this->texture_size = texture_size; |
| 53 this->swizzle_contents = swizzle_contents; | 56 this->swizzle_contents = swizzle_contents; |
| 54 this->nearest_neighbor = nearest_neighbor; | 57 this->nearest_neighbor = nearest_neighbor; |
| 58 this->allow_overlay = allow_overlay; |
| 55 } | 59 } |
| 56 | 60 |
| 57 void ContentDrawQuadBase::ExtendValue( | 61 void ContentDrawQuadBase::ExtendValue( |
| 58 base::trace_event::TracedValue* value) const { | 62 base::trace_event::TracedValue* value) const { |
| 59 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); | 63 MathUtil::AddToTracedValue("tex_coord_rect", tex_coord_rect, value); |
| 60 MathUtil::AddToTracedValue("texture_size", texture_size, value); | 64 MathUtil::AddToTracedValue("texture_size", texture_size, value); |
| 61 | 65 |
| 62 value->SetBoolean("swizzle_contents", swizzle_contents); | 66 value->SetBoolean("swizzle_contents", swizzle_contents); |
| 63 value->SetBoolean("nearest_neighbor", nearest_neighbor); | 67 value->SetBoolean("nearest_neighbor", nearest_neighbor); |
| 68 value->SetBoolean("allow_overlay", allow_overlay); |
| 64 } | 69 } |
| 65 | 70 |
| 66 } // namespace cc | 71 } // namespace cc |
| OLD | NEW |