Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/gl_renderer.h" | 7 #include "cc/gl_renderer.h" |
| 8 | 8 |
| 9 #include "FloatQuad.h" | 9 #include "FloatQuad.h" |
| 10 #include "NotImplemented.h" | 10 #include "NotImplemented.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 // Clamp texture coordinates to avoid sampling outside the layer | 686 // Clamp texture coordinates to avoid sampling outside the layer |
| 687 // by deflating the tile region half a texel or half a texel | 687 // by deflating the tile region half a texel or half a texel |
| 688 // minus epsilon for one pixel layers. The resulting clamp region | 688 // minus epsilon for one pixel layers. The resulting clamp region |
| 689 // is mapped to the unit square by the vertex shader and mapped | 689 // is mapped to the unit square by the vertex shader and mapped |
| 690 // back to normalized texture coordinates by the fragment shader | 690 // back to normalized texture coordinates by the fragment shader |
| 691 // after being clamped to 0-1 range. | 691 // after being clamped to 0-1 range. |
| 692 const float epsilon = 1 / 1024.0f; | 692 const float epsilon = 1 / 1024.0f; |
| 693 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); | 693 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); |
| 694 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); | 694 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); |
| 695 clampRect.Inset(clampX, clampY, clampX, clampY); | 695 clampRect.Inset(clampX, clampY, clampX, clampY); |
| 696 gfx::PointF clampOffset = clampRect.origin() - tileRect.origin(); | 696 gfx::Vector2dF clampOffset = clampRect.origin() - tileRect.origin(); |
|
Peter Kasting
2012/10/27 01:01:39
Nit: If you inline into next statement, the tileRe
danakj
2012/10/29 19:17:20
Done.
| |
| 697 | 697 |
| 698 gfx::PointF textureOffset = quad->textureOffset() + clampOffset + | 698 gfx::PointF textureOffset = quad->textureOffset() + clampOffset + |
| 699 (tileRect.origin() - quad->quadRect().origin()); | 699 (tileRect.origin() - quad->quadRect().origin()); |
| 700 | 700 |
| 701 // Map clamping rectangle to unit square. | 701 // Map clamping rectangle to unit square. |
| 702 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); | 702 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); |
| 703 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); | 703 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); |
| 704 float vertexTexScaleX = tileRect.width() / clampRect.width(); | 704 float vertexTexScaleX = tileRect.width() / clampRect.width(); |
| 705 float vertexTexScaleY = tileRect.height() / clampRect.height(); | 705 float vertexTexScaleY = tileRect.height() / clampRect.height(); |
| 706 | 706 |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1593 | 1593 |
| 1594 releaseRenderPassTextures(); | 1594 releaseRenderPassTextures(); |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 bool GLRenderer::isContextLost() | 1597 bool GLRenderer::isContextLost() |
| 1598 { | 1598 { |
| 1599 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1599 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 } // namespace cc | 1602 } // namespace cc |
| OLD | NEW |