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

Unified Diff: src/gpu/gl/GrGLPathRendering.h

Issue 827973002: ViewMatrix uniform upload moved to GeometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-on-gp
Patch Set: feedback inc Created 6 years 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/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPathRendering.h
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index ee4011d3ac95ae2a24a341e598bb40e798fe62e5..0ebf470adae7015cea02120f77ff6996470b5bba 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -126,10 +126,42 @@ private:
GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode,
GrGLenum transformType, const GrGLfloat *transformValues);
+ struct MatrixState {
+ SkMatrix fViewMatrix;
+ SkISize fRenderTargetSize;
+ GrSurfaceOrigin fRenderTargetOrigin;
+
+ MatrixState() { this->invalidate(); }
+ void invalidate() {
+ fViewMatrix = SkMatrix::InvalidMatrix();
+ fRenderTargetSize.fWidth = -1;
+ fRenderTargetSize.fHeight = -1;
+ fRenderTargetOrigin = (GrSurfaceOrigin) -1;
+ }
+
+ /**
+ * Gets a matrix that goes from local coordinates to GL normalized device coords.
+ */
+ template<int Size> void getRTAdjustedGLMatrix(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, 1);
+ } else {
+ combined.setAll(SkIntToScalar(2) / fRenderTargetSize.fWidth, 0, -SK_Scalar1,
+ 0, SkIntToScalar(2) / fRenderTargetSize.fHeight, -SK_Scalar1,
+ 0, 0, 1);
+ }
+ combined.preConcat(fViewMatrix);
+ GrGLGetMatrix<Size>(destMatrix, combined);
+ }
+ };
+
GrGLGpu* fGpu;
SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator;
Caps fCaps;
- GrGLProgram::MatrixState fHWProjectionMatrixState;
+ MatrixState fHWProjectionMatrixState;
GrStencilSettings fHWPathStencilSettings;
struct PathTexGenData {
GrGLenum fMode;
« no previous file with comments | « src/gpu/gl/GrGLGeometryProcessor.h ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698