| 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 "cc/quads/checkerboard_draw_quad.h" | 8 #include "cc/quads/checkerboard_draw_quad.h" |
| 9 #include "cc/quads/debug_border_draw_quad.h" | 9 #include "cc/quads/debug_border_draw_quad.h" |
| 10 #include "cc/quads/io_surface_draw_quad.h" | 10 #include "cc/quads/io_surface_draw_quad.h" |
| 11 #include "cc/quads/picture_draw_quad.h" |
| 11 #include "cc/quads/render_pass_draw_quad.h" | 12 #include "cc/quads/render_pass_draw_quad.h" |
| 12 #include "cc/quads/solid_color_draw_quad.h" | 13 #include "cc/quads/solid_color_draw_quad.h" |
| 13 #include "cc/quads/stream_video_draw_quad.h" | 14 #include "cc/quads/stream_video_draw_quad.h" |
| 14 #include "cc/quads/texture_draw_quad.h" | 15 #include "cc/quads/texture_draw_quad.h" |
| 15 #include "cc/quads/tile_draw_quad.h" | 16 #include "cc/quads/tile_draw_quad.h" |
| 16 #include "cc/quads/yuv_video_draw_quad.h" | 17 #include "cc/quads/yuv_video_draw_quad.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { | 20 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { |
| 20 return new T(*T::MaterialCast(other)); | 21 return new T(*T::MaterialCast(other)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 switch (material) { | 56 switch (material) { |
| 56 case CHECKERBOARD: | 57 case CHECKERBOARD: |
| 57 copy_quad.reset(TypedCopy<CheckerboardDrawQuad>(this)); | 58 copy_quad.reset(TypedCopy<CheckerboardDrawQuad>(this)); |
| 58 break; | 59 break; |
| 59 case DEBUG_BORDER: | 60 case DEBUG_BORDER: |
| 60 copy_quad.reset(TypedCopy<DebugBorderDrawQuad>(this)); | 61 copy_quad.reset(TypedCopy<DebugBorderDrawQuad>(this)); |
| 61 break; | 62 break; |
| 62 case IO_SURFACE_CONTENT: | 63 case IO_SURFACE_CONTENT: |
| 63 copy_quad.reset(TypedCopy<IOSurfaceDrawQuad>(this)); | 64 copy_quad.reset(TypedCopy<IOSurfaceDrawQuad>(this)); |
| 64 break; | 65 break; |
| 66 case PICTURE_CONTENT: |
| 67 copy_quad.reset(TypedCopy<PictureDrawQuad>(this)); |
| 68 break; |
| 65 case TEXTURE_CONTENT: | 69 case TEXTURE_CONTENT: |
| 66 copy_quad.reset(TypedCopy<TextureDrawQuad>(this)); | 70 copy_quad.reset(TypedCopy<TextureDrawQuad>(this)); |
| 67 break; | 71 break; |
| 68 case SOLID_COLOR: | 72 case SOLID_COLOR: |
| 69 copy_quad.reset(TypedCopy<SolidColorDrawQuad>(this)); | 73 copy_quad.reset(TypedCopy<SolidColorDrawQuad>(this)); |
| 70 break; | 74 break; |
| 71 case TILED_CONTENT: | 75 case TILED_CONTENT: |
| 72 copy_quad.reset(TypedCopy<TileDrawQuad>(this)); | 76 copy_quad.reset(TypedCopy<TileDrawQuad>(this)); |
| 73 break; | 77 break; |
| 74 case STREAM_VIDEO_CONTENT: | 78 case STREAM_VIDEO_CONTENT: |
| 75 copy_quad.reset(TypedCopy<StreamVideoDrawQuad>(this)); | 79 copy_quad.reset(TypedCopy<StreamVideoDrawQuad>(this)); |
| 76 break; | 80 break; |
| 77 case YUV_VIDEO_CONTENT: | 81 case YUV_VIDEO_CONTENT: |
| 78 copy_quad.reset(TypedCopy<YUVVideoDrawQuad>(this)); | 82 copy_quad.reset(TypedCopy<YUVVideoDrawQuad>(this)); |
| 79 break; | 83 break; |
| 80 case RENDER_PASS: // RenderPass quads have their own copy() method. | 84 case RENDER_PASS: // RenderPass quads have their own copy() method. |
| 81 case INVALID: | 85 case INVALID: |
| 82 LOG(FATAL) << "Invalid DrawQuad material " << material; | 86 LOG(FATAL) << "Invalid DrawQuad material " << material; |
| 83 break; | 87 break; |
| 84 } | 88 } |
| 85 copy_quad->shared_quad_state = copied_shared_quad_state; | 89 copy_quad->shared_quad_state = copied_shared_quad_state; |
| 86 return copy_quad.Pass(); | 90 return copy_quad.Pass(); |
| 87 } | 91 } |
| 88 | 92 |
| 89 } // namespace cc | 93 } // namespace cc |
| OLD | NEW |