cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / quads / picture_draw_quad.cc
blob0494764d8aaec4137d509c40bd0cdb4696d3ae73
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"
7 #include "base/values.h"
8 #include "cc/base/math_util.h"
10 namespace cc {
12 PictureDrawQuad::PictureDrawQuad() {
15 PictureDrawQuad::~PictureDrawQuad() {
18 scoped_ptr<PictureDrawQuad> PictureDrawQuad::Create() {
19 return make_scoped_ptr(new PictureDrawQuad);
22 void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
23 gfx::Rect rect,
24 gfx::Rect opaque_rect,
25 const gfx::RectF& tex_coord_rect,
26 gfx::Size texture_size,
27 bool swizzle_contents,
28 gfx::Rect content_rect,
29 float contents_scale,
30 bool can_draw_direct_to_backbuffer,
31 scoped_refptr<PicturePileImpl> picture_pile) {
32 ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::PICTURE_CONTENT,
33 rect, opaque_rect, tex_coord_rect, texture_size,
34 swizzle_contents);
35 this->content_rect = content_rect;
36 this->contents_scale = contents_scale;
37 this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
38 this->picture_pile = picture_pile;
41 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
42 gfx::Rect rect,
43 gfx::Rect opaque_rect,
44 gfx::Rect visible_rect,
45 bool needs_blending,
46 const gfx::RectF& tex_coord_rect,
47 gfx::Size texture_size,
48 bool swizzle_contents,
49 gfx::Rect content_rect,
50 float contents_scale,
51 bool can_draw_direct_to_backbuffer,
52 scoped_refptr<PicturePileImpl> picture_pile) {
53 ContentDrawQuadBase::SetAll(shared_quad_state,
54 DrawQuad::PICTURE_CONTENT, rect, opaque_rect,
55 visible_rect, needs_blending, tex_coord_rect,
56 texture_size, swizzle_contents);
57 this->content_rect = content_rect;
58 this->contents_scale = contents_scale;
59 this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
60 this->picture_pile = picture_pile;
63 void PictureDrawQuad::IterateResources(
64 const ResourceIteratorCallback& callback) {
65 // TODO(danakj): Convert to TextureDrawQuad?
66 NOTIMPLEMENTED();
69 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) {
70 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT);
71 return static_cast<const PictureDrawQuad*>(quad);
74 void PictureDrawQuad::ExtendValue(base::DictionaryValue* value) const {
75 ContentDrawQuadBase::ExtendValue(value);
76 value->Set("content_rect", MathUtil::AsValue(content_rect).release());
77 value->SetDouble("contents_scale", contents_scale);
78 value->SetBoolean("can_draw_direct_to_backbuffer",
79 can_draw_direct_to_backbuffer);
80 // TODO(piman): picture_pile?
83 } // namespace cc