Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "cc/quads/picture_draw_quad.h" |
| 6 | |
| 7 | namespace cc { |
| 8 | |
| 9 | PictureDrawQuad::PictureDrawQuad() { |
| 10 | } |
| 11 | |
| 12 | PictureDrawQuad::~PictureDrawQuad() { |
| 13 | } |
| 14 | |
| 15 | scoped_ptr<PictureDrawQuad> PictureDrawQuad::Create() { |
| 16 | return make_scoped_ptr(new PictureDrawQuad); |
| 17 | } |
| 18 | |
| 19 | void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
| 20 | gfx::Rect rect, |
| 21 | gfx::Rect opaque_rect, |
| 22 | const gfx::RectF& tex_coord_rect, |
| 23 | gfx::Size texture_size, |
| 24 | bool swizzle_contents, |
| 25 | gfx::Rect content_rect, |
| 26 | float contents_scale, |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame^] | 27 | bool can_draw_direct_to_backbuffer, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 28 | scoped_refptr<PicturePileImpl> picture_pile) { |
| 29 | ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::PICTURE_CONTENT, |
| 30 | rect, opaque_rect, tex_coord_rect, texture_size, |
| 31 | swizzle_contents); |
| 32 | this->content_rect = content_rect; |
| 33 | this->contents_scale = contents_scale; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame^] | 34 | this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 35 | this->picture_pile = picture_pile; |
| 36 | } |
| 37 | |
| 38 | void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
| 39 | gfx::Rect rect, |
| 40 | gfx::Rect opaque_rect, |
| 41 | gfx::Rect visible_rect, |
| 42 | bool needs_blending, |
| 43 | const gfx::RectF& tex_coord_rect, |
| 44 | gfx::Size texture_size, |
| 45 | bool swizzle_contents, |
| 46 | gfx::Rect content_rect, |
| 47 | float contents_scale, |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame^] | 48 | bool can_draw_direct_to_backbuffer, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 49 | scoped_refptr<PicturePileImpl> picture_pile) { |
| 50 | ContentDrawQuadBase::SetAll(shared_quad_state, |
| 51 | DrawQuad::PICTURE_CONTENT, rect, opaque_rect, |
| 52 | visible_rect, needs_blending, tex_coord_rect, |
| 53 | texture_size, swizzle_contents); |
| 54 | this->content_rect = content_rect; |
| 55 | this->contents_scale = contents_scale; |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame^] | 56 | this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 57 | this->picture_pile = picture_pile; |
| 58 | } |
| 59 | |
| 60 | void PictureDrawQuad::IterateResources( |
| 61 | const ResourceIteratorCallback& callback) { |
| 62 | // TODO(danakj): Convert to TextureDrawQuad? |
| 63 | NOTIMPLEMENTED(); |
| 64 | } |
| 65 | |
| 66 | const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) { |
| 67 | DCHECK(quad->material == DrawQuad::PICTURE_CONTENT); |
| 68 | return static_cast<const PictureDrawQuad*>(quad); |
| 69 | } |
| 70 | |
| 71 | } // namespace cc |