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.
5 #include "cc/quads/picture_draw_quad.h"
9 PictureDrawQuad::PictureDrawQuad() {
12 PictureDrawQuad::~PictureDrawQuad() {
15 scoped_ptr
<PictureDrawQuad
> PictureDrawQuad::Create() {
16 return make_scoped_ptr(new PictureDrawQuad
);
19 void PictureDrawQuad::SetNew(const SharedQuadState
* shared_quad_state
,
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
,
27 bool can_draw_direct_to_backbuffer
,
28 scoped_refptr
<PicturePileImpl
> picture_pile
) {
29 ContentDrawQuadBase::SetNew(shared_quad_state
, DrawQuad::PICTURE_CONTENT
,
30 rect
, opaque_rect
, tex_coord_rect
, texture_size
,
32 this->content_rect
= content_rect
;
33 this->contents_scale
= contents_scale
;
34 this->can_draw_direct_to_backbuffer
= can_draw_direct_to_backbuffer
;
35 this->picture_pile
= picture_pile
;
38 void PictureDrawQuad::SetAll(const SharedQuadState
* shared_quad_state
,
40 gfx::Rect opaque_rect
,
41 gfx::Rect visible_rect
,
43 const gfx::RectF
& tex_coord_rect
,
44 gfx::Size texture_size
,
45 bool swizzle_contents
,
46 gfx::Rect content_rect
,
48 bool can_draw_direct_to_backbuffer
,
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
;
56 this->can_draw_direct_to_backbuffer
= can_draw_direct_to_backbuffer
;
57 this->picture_pile
= picture_pile
;
60 void PictureDrawQuad::IterateResources(
61 const ResourceIteratorCallback
& callback
) {
62 // TODO(danakj): Convert to TextureDrawQuad?
66 const PictureDrawQuad
* PictureDrawQuad::MaterialCast(const DrawQuad
* quad
) {
67 DCHECK(quad
->material
== DrawQuad::PICTURE_CONTENT
);
68 return static_cast<const PictureDrawQuad
*>(quad
);