OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/texture_draw_quad.h" | 5 #include "cc/texture_draw_quad.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 this->resource_id = resource_id; | 49 this->resource_id = resource_id; |
50 this->premultiplied_alpha = premultiplied_alpha; | 50 this->premultiplied_alpha = premultiplied_alpha; |
51 this->uv_rect = uv_rect; | 51 this->uv_rect = uv_rect; |
52 this->vertex_opacity[0] = vertex_opacity[0]; | 52 this->vertex_opacity[0] = vertex_opacity[0]; |
53 this->vertex_opacity[1] = vertex_opacity[1]; | 53 this->vertex_opacity[1] = vertex_opacity[1]; |
54 this->vertex_opacity[2] = vertex_opacity[2]; | 54 this->vertex_opacity[2] = vertex_opacity[2]; |
55 this->vertex_opacity[3] = vertex_opacity[3]; | 55 this->vertex_opacity[3] = vertex_opacity[3]; |
56 this->flipped = flipped; | 56 this->flipped = flipped; |
57 } | 57 } |
58 | 58 |
| 59 void TextureDrawQuad::AppendResources( |
| 60 ResourceProvider::ResourceIdArray* resources) { |
| 61 resources->push_back(resource_id); |
| 62 } |
| 63 |
59 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { | 64 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { |
60 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); | 65 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); |
61 return static_cast<const TextureDrawQuad*>(quad); | 66 return static_cast<const TextureDrawQuad*>(quad); |
62 } | 67 } |
63 | 68 |
64 bool TextureDrawQuad::PerformClipping() { | 69 bool TextureDrawQuad::PerformClipping() { |
65 // This only occurs if the rect is only scaled and translated (and thus still | 70 // This only occurs if the rect is only scaled and translated (and thus still |
66 // axis aligned). | 71 // axis aligned). |
67 if (!quadTransform().IsPositiveScaleOrTranslation()) | 72 if (!quadTransform().IsPositiveScaleOrTranslation()) |
68 return false; | 73 return false; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 clippedRect -= offset; | 128 clippedRect -= offset; |
124 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); | 129 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); |
125 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), | 130 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), |
126 static_cast<int>(clippedRect.y() + 0.5f), | 131 static_cast<int>(clippedRect.y() + 0.5f), |
127 static_cast<int>(clippedRect.width() + 0.5f), | 132 static_cast<int>(clippedRect.width() + 0.5f), |
128 static_cast<int>(clippedRect.height() + 0.5f)); | 133 static_cast<int>(clippedRect.height() + 0.5f)); |
129 return true; | 134 return true; |
130 } | 135 } |
131 | 136 |
132 } // namespace cc | 137 } // namespace cc |
OLD | NEW |