aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgram.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-05 18:28:42 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-05 18:28:42 +0000
commit215a682d2d561be69b7a28eb76a98849ad03cbc0 (patch)
tree61110b35bbdcb067637e4c4ebecd11dc30ffc37a /src/gpu/gl/GrGLProgram.h
parent9188a15f846ae79892c332aed2a72ee38116bdc6 (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/GrGLProgram.h')
-rw-r--r--src/gpu/gl/GrGLProgram.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 283ac03d22..4a16b0cf4c 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -100,6 +100,20 @@ public:
fRenderTargetSize.fHeight = -1;
fRenderTargetOrigin = (GrSurfaceOrigin) -1;
}
+ template<int Size> void getGLMatrix(GrGLfloat* destMatrix) {
+ SkMatrix combined;
+ if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) {
+ combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1,
+ 0, -SkIntToScalar(2) / fRenderTargetSize.fHeight, SK_Scalar1,
+ 0, 0, SkMatrix::I()[8]);
+ } else {
+ combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1,
+ 0, SkIntToScalar(2) / fRenderTargetSize.fHeight, -SK_Scalar1,
+ 0, 0, SkMatrix::I()[8]);
+ }
+ combined.setConcat(combined, fViewMatrix);
+ GrGLGetMatrix<Size>(destMatrix, combined);
+ }
};
/**