| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gl/GrGLPathRendering.h" | 8 #include "gl/GrGLPathRendering.h" |
| 9 #include "gl/GrGLNameAllocator.h" | 9 #include "gl/GrGLNameAllocator.h" |
| 10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 GL_CALL(StencilThenCoverFillPathInstanced( | 179 GL_CALL(StencilThenCoverFillPathInstanced( |
| 180 count, gIndexType2GLType[indexType], indices, glPath
Range->basePathID(), | 180 count, gIndexType2GLType[indexType], indices, glPath
Range->basePathID(), |
| 181 fillMode, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_
BOXES, | 181 fillMode, writeMask, GR_GL_BOUNDING_BOX_OF_BOUNDING_
BOXES, |
| 182 gXformType2GLType[transformType], transformValues)); | 182 gXformType2GLType[transformType], transformValues)); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, G
rGLint location, | 186 void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, G
rGLint location, |
| 187 GrGLenum genMode, G
rGLint components, | 187 GrGLenum genMode, G
rGLint components, |
| 188 const SkMatrix& mat
rix) { | 188 const SkMatrix& mat
rix) { |
| 189 GrGLfloat coefficients[3 * 3]; | 189 float coefficients[3 * 3]; |
| 190 SkASSERT(components >= 1 && components <= 3); | 190 SkASSERT(components >= 1 && components <= 3); |
| 191 | 191 |
| 192 coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]); | 192 coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]); |
| 193 coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]); | 193 coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]); |
| 194 coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]); | 194 coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]); |
| 195 | 195 |
| 196 if (components >= 2) { | 196 if (components >= 2) { |
| 197 coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]); | 197 coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]); |
| 198 coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]); | 198 coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]); |
| 199 coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]); | 199 coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 217 if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin && | 217 if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin && |
| 218 renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize && | 218 renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize && |
| 219 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { | 219 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { |
| 220 return; | 220 return; |
| 221 } | 221 } |
| 222 | 222 |
| 223 fHWProjectionMatrixState.fViewMatrix = matrix; | 223 fHWProjectionMatrixState.fViewMatrix = matrix; |
| 224 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; | 224 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; |
| 225 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; | 225 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; |
| 226 | 226 |
| 227 GrGLfloat glMatrix[4 * 4]; | 227 float glMatrix[4 * 4]; |
| 228 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); | 228 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix); |
| 229 GL_CALL(MatrixLoadf(GR_GL_PATH_PROJECTION, glMatrix)); | 229 GL_CALL(MatrixLoadf(GR_GL_PATH_PROJECTION, glMatrix)); |
| 230 } | 230 } |
| 231 | 231 |
| 232 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { | 232 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { |
| 233 if (range > 1) { | 233 if (range > 1) { |
| 234 GrGLuint name; | 234 GrGLuint name; |
| 235 GL_CALL_RET(name, GenPaths(range)); | 235 GL_CALL_RET(name, GenPaths(range)); |
| 236 return name; | 236 return name; |
| 237 } | 237 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 GL_CALL(PathStencilFunc(func, stencilSettings.funcRef(GrStencilSettings:
:kFront_Face), | 289 GL_CALL(PathStencilFunc(func, stencilSettings.funcRef(GrStencilSettings:
:kFront_Face), |
| 290 stencilSettings.funcMask(GrStencilSettings::kFro
nt_Face))); | 290 stencilSettings.funcMask(GrStencilSettings::kFro
nt_Face))); |
| 291 | 291 |
| 292 fHWPathStencilSettings = stencilSettings; | 292 fHWPathStencilSettings = stencilSettings; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 inline GrGLGpu* GrGLPathRendering::gpu() { | 296 inline GrGLGpu* GrGLPathRendering::gpu() { |
| 297 return static_cast<GrGLGpu*>(fGpu); | 297 return static_cast<GrGLGpu*>(fGpu); |
| 298 } | 298 } |
| OLD | NEW |