Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: cc/gl_renderer.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consts Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 // Clamp texture coordinates to avoid sampling outside the layer 681 // Clamp texture coordinates to avoid sampling outside the layer
682 // by deflating the tile region half a texel or half a texel 682 // by deflating the tile region half a texel or half a texel
683 // minus epsilon for one pixel layers. The resulting clamp region 683 // minus epsilon for one pixel layers. The resulting clamp region
684 // is mapped to the unit square by the vertex shader and mapped 684 // is mapped to the unit square by the vertex shader and mapped
685 // back to normalized texture coordinates by the fragment shader 685 // back to normalized texture coordinates by the fragment shader
686 // after being clamped to 0-1 range. 686 // after being clamped to 0-1 range.
687 const float epsilon = 1 / 1024.0f; 687 const float epsilon = 1 / 1024.0f;
688 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); 688 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon);
689 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); 689 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
690 clampRect.Inset(clampX, clampY, clampX, clampY); 690 clampRect.Inset(clampX, clampY, clampX, clampY);
691 gfx::PointF clampOffset = clampRect.origin() - tileRect.origin(); 691 gfx::Vector2dF clampOffset = clampRect.origin() - tileRect.origin();
692 692
693 gfx::PointF textureOffset = quad->textureOffset() + clampOffset + 693 gfx::PointF textureOffset = quad->textureOffset() + clampOffset +
694 (tileRect.origin() - quad->quadRect().origin()); 694 (tileRect.origin() - quad->quadRect().origin());
695 695
696 // Map clamping rectangle to unit square. 696 // Map clamping rectangle to unit square.
697 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); 697 float vertexTexTranslateX = -clampRect.x() / clampRect.width();
698 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); 698 float vertexTexTranslateY = -clampRect.y() / clampRect.height();
699 float vertexTexScaleX = tileRect.width() / clampRect.width(); 699 float vertexTexScaleX = tileRect.width() / clampRect.width();
700 float vertexTexScaleY = tileRect.height() / clampRect.height(); 700 float vertexTexScaleY = tileRect.height() / clampRect.height();
701 701
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 1588
1589 releaseRenderPassTextures(); 1589 releaseRenderPassTextures();
1590 } 1590 }
1591 1591
1592 bool GLRenderer::isContextLost() 1592 bool GLRenderer::isContextLost()
1593 { 1593 {
1594 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1594 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1595 } 1595 }
1596 1596
1597 } // namespace cc 1597 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698