From 215a682d2d561be69b7a28eb76a98849ad03cbc0 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 5 Sep 2013 18:28:42 +0000 Subject: 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 --- src/gpu/gl/GrGpuGL_program.cpp | 43 ++++++------------------------------------ 1 file changed, 6 insertions(+), 37 deletions(-) (limited to 'src/gpu/gl/GrGpuGL_program.cpp') 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)); } } -- cgit v1.2.3