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

Unified Diff: src/gpu/gl/GrGpuGL_program.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL_program.cpp
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 0795dfad4f2b6efb898840623d5e31f9effb138d..ce743038951b5a245e92963ff63b56f8a79b41d3 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -212,46 +212,15 @@ void GrGpuGL::flushPathStencilMatrix() {
if (fHWProjectionMatrixState.fRenderTargetOrigin != rt->origin() ||
!fHWProjectionMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) ||
fHWProjectionMatrixState.fRenderTargetSize!= size) {
- // rescale the coords from skia's "device" coords to GL's normalized coords,
- // and perform a y-flip if required.
- SkMatrix m;
- if (kBottomLeft_GrSurfaceOrigin == rt->origin()) {
- m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(-2) / rt->height());
- m.postTranslate(-SK_Scalar1, SK_Scalar1);
- } else {
- m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(2) / rt->height());
- m.postTranslate(-SK_Scalar1, -SK_Scalar1);
- }
- m.preConcat(vm);
-
- // GL wants a column-major 4x4.
- GrGLfloat mv[] = {
- // col 0
- SkScalarToFloat(m[SkMatrix::kMScaleX]),
- SkScalarToFloat(m[SkMatrix::kMSkewY]),
- 0,
- SkScalarToFloat(m[SkMatrix::kMPersp0]),
-
- // col 1
- SkScalarToFloat(m[SkMatrix::kMSkewX]),
- SkScalarToFloat(m[SkMatrix::kMScaleY]),
- 0,
- SkScalarToFloat(m[SkMatrix::kMPersp1]),
-
- // col 2
- 0, 0, 0, 0,
-
- // col3
- SkScalarToFloat(m[SkMatrix::kMTransX]),
- SkScalarToFloat(m[SkMatrix::kMTransY]),
- 0.0f,
- SkScalarToFloat(m[SkMatrix::kMPersp2])
- };
- GL_CALL(MatrixMode(GR_GL_PROJECTION));
- GL_CALL(LoadMatrixf(mv));
+
fHWProjectionMatrixState.fViewMatrix = vm;
fHWProjectionMatrixState.fRenderTargetSize = size;
fHWProjectionMatrixState.fRenderTargetOrigin = rt->origin();
+
+ GrGLfloat projectionMatrix[4 * 4];
+ fHWProjectionMatrixState.getGLMatrix<4>(projectionMatrix);
+ GL_CALL(MatrixMode(GR_GL_PROJECTION));
+ GL_CALL(LoadMatrixf(projectionMatrix));
Mark Kilgard 2013/09/05 18:39:34 BTW, good opportunity to simply use DSA GL_CALL ve
bsalomon 2013/09/05 18:40:44 nice!
}
}
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698