| 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 #include "ui/gfx/vector2d_f.h" | 8 #include "ui/gfx/vector2d_f.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 this->vertex_opacity[2] = vertex_opacity[2]; | 63 this->vertex_opacity[2] = vertex_opacity[2]; |
| 64 this->vertex_opacity[3] = vertex_opacity[3]; | 64 this->vertex_opacity[3] = vertex_opacity[3]; |
| 65 this->flipped = flipped; | 65 this->flipped = flipped; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void TextureDrawQuad::AppendResources( | 68 void TextureDrawQuad::AppendResources( |
| 69 ResourceProvider::ResourceIdArray* resources) { | 69 ResourceProvider::ResourceIdArray* resources) { |
| 70 resources->push_back(resource_id); | 70 resources->push_back(resource_id); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void TextureDrawQuad::RemapResources( |
| 74 const ResourceRemapCallback& remap_callback) { |
| 75 resource_id = remap_callback.Run(resource_id); |
| 76 } |
| 77 |
| 73 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { | 78 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { |
| 74 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); | 79 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); |
| 75 return static_cast<const TextureDrawQuad*>(quad); | 80 return static_cast<const TextureDrawQuad*>(quad); |
| 76 } | 81 } |
| 77 | 82 |
| 78 bool TextureDrawQuad::PerformClipping() { | 83 bool TextureDrawQuad::PerformClipping() { |
| 79 // This only occurs if the rect is only scaled and translated (and thus still | 84 // This only occurs if the rect is only scaled and translated (and thus still |
| 80 // axis aligned). | 85 // axis aligned). |
| 81 if (!quadTransform().IsPositiveScaleOrTranslation()) | 86 if (!quadTransform().IsPositiveScaleOrTranslation()) |
| 82 return false; | 87 return false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 clippedRect -= offset; | 148 clippedRect -= offset; |
| 144 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); | 149 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); |
| 145 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), | 150 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), |
| 146 static_cast<int>(clippedRect.y() + 0.5f), | 151 static_cast<int>(clippedRect.y() + 0.5f), |
| 147 static_cast<int>(clippedRect.width() + 0.5f), | 152 static_cast<int>(clippedRect.width() + 0.5f), |
| 148 static_cast<int>(clippedRect.height() + 0.5f)); | 153 static_cast<int>(clippedRect.height() + 0.5f)); |
| 149 return true; | 154 return true; |
| 150 } | 155 } |
| 151 | 156 |
| 152 } // namespace cc | 157 } // namespace cc |
| OLD | NEW |