diff options
author | 2013-09-05 18:28:42 +0000 | |
---|---|---|
committer | 2013-09-05 18:28:42 +0000 | |
commit | 215a682d2d561be69b7a28eb76a98849ad03cbc0 (patch) | |
tree | 61110b35bbdcb067637e4c4ebecd11dc30ffc37a /src/gpu/gl/GrGpuGL_program.cpp | |
parent | 9188a15f846ae79892c332aed2a72ee38116bdc6 (diff) |
Add getGLMatrix method to MatrixState
Removes redundant code by consolidating it into a single method. No
change in functionality, this is strictly a refactoring.
R=bsalomon@google.com
Author: cdalton@nvidia.com
Review URL: https://chromiumcodereview.appspot.com/23767005
git-svn-id: http://skia.googlecode.com/svn/trunk@11112 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGpuGL_program.cpp')
-rw-r--r-- | src/gpu/gl/GrGpuGL_program.cpp | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 0795dfad4f..ce74303895 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)); } } |