| 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // Clamp texture coordinates to avoid sampling outside the layer | 685 // Clamp texture coordinates to avoid sampling outside the layer |
| 686 // by deflating the tile region half a texel or half a texel | 686 // by deflating the tile region half a texel or half a texel |
| 687 // minus epsilon for one pixel layers. The resulting clamp region | 687 // minus epsilon for one pixel layers. The resulting clamp region |
| 688 // is mapped to the unit square by the vertex shader and mapped | 688 // is mapped to the unit square by the vertex shader and mapped |
| 689 // back to normalized texture coordinates by the fragment shader | 689 // back to normalized texture coordinates by the fragment shader |
| 690 // after being clamped to 0-1 range. | 690 // after being clamped to 0-1 range. |
| 691 const float epsilon = 1 / 1024.0f; | 691 const float epsilon = 1 / 1024.0f; |
| 692 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); | 692 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); |
| 693 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); | 693 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); |
| 694 clampRect.Inset(clampX, clampY, clampX, clampY); | 694 clampRect.Inset(clampX, clampY, clampX, clampY); |
| 695 gfx::PointF clampOffset = clampRect.origin() - tileRect.origin(); | |
| 696 | 695 |
| 697 gfx::PointF textureOffset = quad->textureOffset() + clampOffset + | 696 gfx::PointF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrig
in() - quad->quadRect().OffsetFromOrigin(); |
| 698 (tileRect.origin() - quad->quadRect().origin()); | |
| 699 | 697 |
| 700 // Map clamping rectangle to unit square. | 698 // Map clamping rectangle to unit square. |
| 701 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); | 699 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); |
| 702 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); | 700 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); |
| 703 float vertexTexScaleX = tileRect.width() / clampRect.width(); | 701 float vertexTexScaleX = tileRect.width() / clampRect.width(); |
| 704 float vertexTexScaleY = tileRect.height() / clampRect.height(); | 702 float vertexTexScaleY = tileRect.height() / clampRect.height(); |
| 705 | 703 |
| 706 // Map to normalized texture coordinates. | 704 // Map to normalized texture coordinates. |
| 707 const gfx::Size& textureSize = quad->textureSize(); | 705 const gfx::Size& textureSize = quad->textureSize(); |
| 708 float fragmentTexTranslateX = textureOffset.x() / textureSize.width(); | 706 float fragmentTexTranslateX = textureOffset.x() / textureSize.width(); |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 | 1590 |
| 1593 releaseRenderPassTextures(); | 1591 releaseRenderPassTextures(); |
| 1594 } | 1592 } |
| 1595 | 1593 |
| 1596 bool GLRenderer::isContextLost() | 1594 bool GLRenderer::isContextLost() |
| 1597 { | 1595 { |
| 1598 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1596 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1599 } | 1597 } |
| 1600 | 1598 |
| 1601 } // namespace cc | 1599 } // namespace cc |
| OLD | NEW |