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 bool nearest_neighbor, |
26 ResourceFormat texture_format, | 27 ResourceFormat texture_format, |
27 const gfx::Rect& content_rect, | 28 const gfx::Rect& content_rect, |
28 float contents_scale, | 29 float contents_scale, |
29 scoped_refptr<RasterSource> raster_source) { | 30 scoped_refptr<RasterSource> raster_source) { |
30 ContentDrawQuadBase::SetNew( | 31 ContentDrawQuadBase::SetNew( |
31 shared_quad_state, | 32 shared_quad_state, |
32 DrawQuad::PICTURE_CONTENT, | 33 DrawQuad::PICTURE_CONTENT, |
33 rect, | 34 rect, |
34 opaque_rect, | 35 opaque_rect, |
35 visible_rect, | 36 visible_rect, |
36 tex_coord_rect, | 37 tex_coord_rect, |
37 texture_size, | 38 texture_size, |
38 !PlatformColor::SameComponentOrder(texture_format)); | 39 !PlatformColor::SameComponentOrder(texture_format), |
| 40 nearest_neighbor); |
39 this->content_rect = content_rect; | 41 this->content_rect = content_rect; |
40 this->contents_scale = contents_scale; | 42 this->contents_scale = contents_scale; |
41 this->raster_source = raster_source; | 43 this->raster_source = raster_source; |
42 this->texture_format = texture_format; | 44 this->texture_format = texture_format; |
43 } | 45 } |
44 | 46 |
45 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 47 void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
46 const gfx::Rect& rect, | 48 const gfx::Rect& rect, |
47 const gfx::Rect& opaque_rect, | 49 const gfx::Rect& opaque_rect, |
48 const gfx::Rect& visible_rect, | 50 const gfx::Rect& visible_rect, |
49 bool needs_blending, | 51 bool needs_blending, |
50 const gfx::RectF& tex_coord_rect, | 52 const gfx::RectF& tex_coord_rect, |
51 const gfx::Size& texture_size, | 53 const gfx::Size& texture_size, |
| 54 bool nearest_neighbor, |
52 ResourceFormat texture_format, | 55 ResourceFormat texture_format, |
53 const gfx::Rect& content_rect, | 56 const gfx::Rect& content_rect, |
54 float contents_scale, | 57 float contents_scale, |
55 scoped_refptr<RasterSource> raster_source) { | 58 scoped_refptr<RasterSource> raster_source) { |
56 ContentDrawQuadBase::SetAll(shared_quad_state, | 59 ContentDrawQuadBase::SetAll(shared_quad_state, |
57 DrawQuad::PICTURE_CONTENT, | 60 DrawQuad::PICTURE_CONTENT, |
58 rect, | 61 rect, |
59 opaque_rect, | 62 opaque_rect, |
60 visible_rect, | 63 visible_rect, |
61 needs_blending, | 64 needs_blending, |
62 tex_coord_rect, | 65 tex_coord_rect, |
63 texture_size, | 66 texture_size, |
64 !PlatformColor::SameComponentOrder( | 67 !PlatformColor::SameComponentOrder( |
65 texture_format)); | 68 texture_format), |
| 69 nearest_neighbor); |
66 this->content_rect = content_rect; | 70 this->content_rect = content_rect; |
67 this->contents_scale = contents_scale; | 71 this->contents_scale = contents_scale; |
68 this->raster_source = raster_source; | 72 this->raster_source = raster_source; |
69 this->texture_format = texture_format; | 73 this->texture_format = texture_format; |
70 } | 74 } |
71 | 75 |
72 void PictureDrawQuad::IterateResources( | 76 void PictureDrawQuad::IterateResources( |
73 const ResourceIteratorCallback& callback) { | 77 const ResourceIteratorCallback& callback) { |
74 // TODO(danakj): Convert to TextureDrawQuad? | 78 // TODO(danakj): Convert to TextureDrawQuad? |
75 NOTIMPLEMENTED(); | 79 NOTIMPLEMENTED(); |
76 } | 80 } |
77 | 81 |
78 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) { | 82 const PictureDrawQuad* PictureDrawQuad::MaterialCast(const DrawQuad* quad) { |
79 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT); | 83 DCHECK(quad->material == DrawQuad::PICTURE_CONTENT); |
80 return static_cast<const PictureDrawQuad*>(quad); | 84 return static_cast<const PictureDrawQuad*>(quad); |
81 } | 85 } |
82 | 86 |
83 void PictureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { | 87 void PictureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { |
84 ContentDrawQuadBase::ExtendValue(value); | 88 ContentDrawQuadBase::ExtendValue(value); |
85 value->BeginArray("content_rect"); | 89 value->BeginArray("content_rect"); |
86 MathUtil::AddToTracedValue(content_rect, value); | 90 MathUtil::AddToTracedValue(content_rect, value); |
87 value->EndArray(); | 91 value->EndArray(); |
88 value->SetDouble("contents_scale", contents_scale); | 92 value->SetDouble("contents_scale", contents_scale); |
89 value->SetInteger("texture_format", texture_format); | 93 value->SetInteger("texture_format", texture_format); |
90 // TODO(piman): raster_source? | 94 // TODO(piman): raster_source? |
91 } | 95 } |
92 | 96 |
93 } // namespace cc | 97 } // namespace cc |
OLD | NEW |