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

Side by Side Diff: src/gpu/gl/GrGLProgram.cpp

Issue 23767005: Add getGLMatrix method to MatrixState (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months 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 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLProgram.h" 8 #include "GrGLProgram.h"
9 9
10 #include "GrAllocator.h" 10 #include "GrAllocator.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 973
974 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. 974 // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
975 if (fUniformHandles.fRTHeightUni.isValid() && 975 if (fUniformHandles.fRTHeightUni.isValid() &&
976 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) { 976 fMatrixState.fRenderTargetSize.fHeight != size.fHeight) {
977 fUniformManager.set1f(fUniformHandles.fRTHeightUni, SkIntToScalar(size.f Height)); 977 fUniformManager.set1f(fUniformHandles.fRTHeightUni, SkIntToScalar(size.f Height));
978 } 978 }
979 979
980 if (fMatrixState.fRenderTargetOrigin != rt->origin() || 980 if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
981 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) || 981 !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) ||
982 fMatrixState.fRenderTargetSize != size) { 982 fMatrixState.fRenderTargetSize != size) {
983 SkMatrix m;
984 if (kBottomLeft_GrSurfaceOrigin == rt->origin()) {
985 m.setAll(
986 SkIntToScalar(2) / size.fWidth, 0, -SK_Scalar1,
987 0,-SkIntToScalar(2) / size.fHeight, SK_Scalar1,
988 0, 0, SkMatrix::I()[8]);
989 } else {
990 m.setAll(
991 SkIntToScalar(2) / size.fWidth, 0, -SK_Scalar1,
992 0, SkIntToScalar(2) / size.fHeight,-SK_Scalar1,
993 0, 0, SkMatrix::I()[8]);
994 }
995 m.setConcat(m, drawState.getViewMatrix());
996 983
997 // ES doesn't allow you to pass true to the transpose param so we do our own transpose.
998 GrGLfloat mt[] = {
999 SkScalarToFloat(m[SkMatrix::kMScaleX]),
1000 SkScalarToFloat(m[SkMatrix::kMSkewY]),
1001 SkScalarToFloat(m[SkMatrix::kMPersp0]),
1002 SkScalarToFloat(m[SkMatrix::kMSkewX]),
1003 SkScalarToFloat(m[SkMatrix::kMScaleY]),
1004 SkScalarToFloat(m[SkMatrix::kMPersp1]),
1005 SkScalarToFloat(m[SkMatrix::kMTransX]),
1006 SkScalarToFloat(m[SkMatrix::kMTransY]),
1007 SkScalarToFloat(m[SkMatrix::kMPersp2])
1008 };
1009 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, mt);
1010 fMatrixState.fViewMatrix = drawState.getViewMatrix(); 984 fMatrixState.fViewMatrix = drawState.getViewMatrix();
1011 fMatrixState.fRenderTargetSize = size; 985 fMatrixState.fRenderTargetSize = size;
1012 fMatrixState.fRenderTargetOrigin = rt->origin(); 986 fMatrixState.fRenderTargetOrigin = rt->origin();
987
988 GrGLfloat viewMatrix[3 * 3];
989 fMatrixState.getGLMatrix<3>(viewMatrix);
990 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix);
1013 } 991 }
1014 } 992 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLUtil.h » ('j') | src/gpu/gl/GrGpuGL_program.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698