OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/picture_draw_quad.h" | 5 #include "cc/quads/picture_draw_quad.h" |
6 | 6 |
7 #include "base/debug/trace_event_argument.h" | 7 #include "base/debug/trace_event_argument.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/resources/platform_color.h" | 10 #include "cc/resources/platform_color.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 PictureDrawQuad::PictureDrawQuad() { | 14 PictureDrawQuad::PictureDrawQuad() { |
15 } | 15 } |
16 | 16 |
17 PictureDrawQuad::~PictureDrawQuad() { | 17 PictureDrawQuad::~PictureDrawQuad() { |
18 } | 18 } |
19 | 19 |
20 void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, | 20 void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, |
21 const gfx::Rect& rect, | 21 const gfx::Rect& rect, |
22 const gfx::Rect& opaque_rect, | 22 const gfx::Rect& opaque_rect, |
23 const gfx::Rect& visible_rect, | 23 const gfx::Rect& visible_rect, |
24 const gfx::RectF& tex_coord_rect, | 24 const gfx::RectF& tex_coord_rect, |
25 const gfx::Size& texture_size, | 25 const gfx::Size& texture_size, |
26 ResourceFormat texture_format, | 26 ResourceFormat texture_format, |
27 const gfx::Rect& content_rect, | 27 const gfx::Rect& content_rect, |
28 float contents_scale, | 28 float contents_scale, |
29 scoped_refptr<PicturePileImpl> picture_pile) { | 29 scoped_refptr<RasterSource> raster_source) { |
30 ContentDrawQuadBase::SetNew( | 30 ContentDrawQuadBase::SetNew( |
31 shared_quad_state, | 31 shared_quad_state, |
32 DrawQuad::PICTURE_CONTENT, | 32 DrawQuad::PICTURE_CONTENT, |
33 rect, | 33 rect, |
34 opaque_rect, | 34 opaque_rect, |
35 visible_rect, | 35 visible_rect, |
36 tex_coord_rect, | 36 tex_coord_rect, |
37 texture_size, | 37 texture_size, |
38 !PlatformColor::SameComponentOrder(texture_format)); | 38 !PlatformColor::SameComponentOrder(texture_format)); |
39 this->content_rect = content_rect; | 39 this->content_rect = content_rect; |
40 this->contents_scale = contents_scale; | 40 this->contents_scale = contents_scale; |
41 this->picture_pile = picture_pile; | 41 this->raster_source = raster_source; |
42 this->texture_format = texture_format; | 42 this->texture_format = texture_format; |
43 } | 43 } |
44 | 44 |
45 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 45 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
46 const gfx::Rect& rect, | 46 const gfx::Rect& rect, |
47 const gfx::Rect& opaque_rect, | 47 const gfx::Rect& opaque_rect, |
48 const gfx::Rect& visible_rect, | 48 const gfx::Rect& visible_rect, |
49 bool needs_blending, | 49 bool needs_blending, |
50 const gfx::RectF& tex_coord_rect, | 50 const gfx::RectF& tex_coord_rect, |
51 const gfx::Size& texture_size, | 51 const gfx::Size& texture_size, |
52 ResourceFormat texture_format, | 52 ResourceFormat texture_format, |
53 const gfx::Rect& content_rect, | 53 const gfx::Rect& content_rect, |
54 float contents_scale, | 54 float contents_scale, |
55 scoped_refptr<PicturePileImpl> picture_pile) { | 55 scoped_refptr<RasterSource> raster_source) { |
56 ContentDrawQuadBase::SetAll(shared_quad_state, | 56 ContentDrawQuadBase::SetAll(shared_quad_state, |
57 DrawQuad::PICTURE_CONTENT, | 57 DrawQuad::PICTURE_CONTENT, |
58 rect, | 58 rect, |
59 opaque_rect, | 59 opaque_rect, |
60 visible_rect, | 60 visible_rect, |
61 needs_blending, | 61 needs_blending, |
62 tex_coord_rect, | 62 tex_coord_rect, |
63 texture_size, | 63 texture_size, |
64 !PlatformColor::SameComponentOrder( | 64 !PlatformColor::SameComponentOrder( |
65 texture_format)); | 65 texture_format)); |
66 this->content_rect = content_rect; | 66 this->content_rect = content_rect; |
67 this->contents_scale = contents_scale; | 67 this->contents_scale = contents_scale; |
68 this->picture_pile = picture_pile; | 68 this->raster_source = raster_source; |
69 this->texture_format = texture_format; | 69 this->texture_format = texture_format; |
70 } | 70 } |
71 | 71 |
72 void PictureDrawQuad::IterateResources( | 72 void PictureDrawQuad::IterateResources( |
73 const ResourceIteratorCallback& callback) { | 73 const ResourceIteratorCallback& callback) { |
74 // TODO(danakj): Convert to TextureDrawQuad? | 74 // TODO(danakj): Convert to TextureDrawQuad? |
75 NOTIMPLEMENTED(); | 75 NOTIMPLEMENTED(); |
76 } | 76 } |
77 | 77 |
78 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) { | 78 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) { |
79 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT); | 79 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT); |
80 return static_cast<const PictureDrawQuad*>(quad); | 80 return static_cast<const PictureDrawQuad*>(quad); |
81 } | 81 } |
82 | 82 |
83 void PictureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { | 83 void PictureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { |
84 ContentDrawQuadBase::ExtendValue(value); | 84 ContentDrawQuadBase::ExtendValue(value); |
85 value->BeginArray("content_rect"); | 85 value->BeginArray("content_rect"); |
86 MathUtil::AddToTracedValue(content_rect, value); | 86 MathUtil::AddToTracedValue(content_rect, value); |
87 value->EndArray(); | 87 value->EndArray(); |
88 value->SetDouble("contents_scale", contents_scale); | 88 value->SetDouble("contents_scale", contents_scale); |
89 value->SetInteger("texture_format", texture_format); | 89 value->SetInteger("texture_format", texture_format); |
90 // TODO(piman): picture_pile? | 90 // TODO(piman): raster_source? |
91 } | 91 } |
92 | 92 |
93 } // namespace cc | 93 } // namespace cc |
OLD | NEW |