| 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/draw_quad.h" | 5 #include "cc/quads/draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
| 11 #include "cc/quads/checkerboard_draw_quad.h" | 11 #include "cc/quads/checkerboard_draw_quad.h" |
| 12 #include "cc/quads/debug_border_draw_quad.h" | 12 #include "cc/quads/debug_border_draw_quad.h" |
| 13 #include "cc/quads/io_surface_draw_quad.h" | 13 #include "cc/quads/io_surface_draw_quad.h" |
| 14 #include "cc/quads/picture_draw_quad.h" | 14 #include "cc/quads/picture_draw_quad.h" |
| 15 #include "cc/quads/render_pass_draw_quad.h" | 15 #include "cc/quads/render_pass_draw_quad.h" |
| 16 #include "cc/quads/solid_color_draw_quad.h" | 16 #include "cc/quads/solid_color_draw_quad.h" |
| 17 #include "cc/quads/stream_video_draw_quad.h" | 17 #include "cc/quads/stream_video_draw_quad.h" |
| 18 #include "cc/quads/surface_draw_quad.h" |
| 18 #include "cc/quads/texture_draw_quad.h" | 19 #include "cc/quads/texture_draw_quad.h" |
| 19 #include "cc/quads/tile_draw_quad.h" | 20 #include "cc/quads/tile_draw_quad.h" |
| 20 #include "cc/quads/yuv_video_draw_quad.h" | 21 #include "cc/quads/yuv_video_draw_quad.h" |
| 21 #include "ui/gfx/quad_f.h" | 22 #include "ui/gfx/quad_f.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { | 25 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { |
| 25 return new T(*T::MaterialCast(other)); | 26 return new T(*T::MaterialCast(other)); |
| 26 } | 27 } |
| 27 } // namespace | 28 } // namespace |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 break; | 83 break; |
| 83 case SOLID_COLOR: | 84 case SOLID_COLOR: |
| 84 copy_quad.reset(TypedCopy<SolidColorDrawQuad>(this)); | 85 copy_quad.reset(TypedCopy<SolidColorDrawQuad>(this)); |
| 85 break; | 86 break; |
| 86 case TILED_CONTENT: | 87 case TILED_CONTENT: |
| 87 copy_quad.reset(TypedCopy<TileDrawQuad>(this)); | 88 copy_quad.reset(TypedCopy<TileDrawQuad>(this)); |
| 88 break; | 89 break; |
| 89 case STREAM_VIDEO_CONTENT: | 90 case STREAM_VIDEO_CONTENT: |
| 90 copy_quad.reset(TypedCopy<StreamVideoDrawQuad>(this)); | 91 copy_quad.reset(TypedCopy<StreamVideoDrawQuad>(this)); |
| 91 break; | 92 break; |
| 93 case SURFACE_CONTENT: |
| 94 copy_quad.reset(TypedCopy<SurfaceDrawQuad>(this)); |
| 95 break; |
| 92 case YUV_VIDEO_CONTENT: | 96 case YUV_VIDEO_CONTENT: |
| 93 copy_quad.reset(TypedCopy<YUVVideoDrawQuad>(this)); | 97 copy_quad.reset(TypedCopy<YUVVideoDrawQuad>(this)); |
| 94 break; | 98 break; |
| 95 case RENDER_PASS: // RenderPass quads have their own copy() method. | 99 case RENDER_PASS: // RenderPass quads have their own copy() method. |
| 96 case INVALID: | 100 case INVALID: |
| 97 LOG(FATAL) << "Invalid DrawQuad material " << material; | 101 LOG(FATAL) << "Invalid DrawQuad material " << material; |
| 98 break; | 102 break; |
| 99 } | 103 } |
| 100 copy_quad->shared_quad_state = copied_shared_quad_state; | 104 copy_quad->shared_quad_state = copied_shared_quad_state; |
| 101 return copy_quad.Pass(); | 105 return copy_quad.Pass(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 MathUtil::AsValue(visible_rect_as_target_space_quad).release()); | 143 MathUtil::AsValue(visible_rect_as_target_space_quad).release()); |
| 140 value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped); | 144 value->SetBoolean("visible_rect_is_clipped", visible_rect_is_clipped); |
| 141 | 145 |
| 142 value->SetBoolean("needs_blending", needs_blending); | 146 value->SetBoolean("needs_blending", needs_blending); |
| 143 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending()); | 147 value->SetBoolean("should_draw_with_blending", ShouldDrawWithBlending()); |
| 144 ExtendValue(value.get()); | 148 ExtendValue(value.get()); |
| 145 return value.PassAs<base::Value>(); | 149 return value.PassAs<base::Value>(); |
| 146 } | 150 } |
| 147 | 151 |
| 148 } // namespace cc | 152 } // namespace cc |
| OLD | NEW |