| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 this->stencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDING_B
OX); | 190 this->stencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDING_B
OX); |
| 191 } else { | 191 } else { |
| 192 this->stencilThenCoverFillPath(id, fillMode, writeMask, GR_GL_BOUNDING_B
OX); | 192 this->stencilThenCoverFillPath(id, fillMode, writeMask, GR_GL_BOUNDING_B
OX); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, | 196 void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, |
| 197 const void* indices, PathIndexType indexType, | 197 const void* indices, PathIndexType indexType, |
| 198 const float transformValues[], PathTransformTy
pe transformType, | 198 const float transformValues[], PathTransformTy
pe transformType, |
| 199 int count, const GrStencilSettings& stencilSet
tings) { | 199 int count, const GrStencilSettings& stencilSet
tings) { |
| 200 SkASSERT(fGpu->caps()->pathRenderingSupport()); | 200 SkASSERT(fGpu->caps()->shaderCaps()->pathRenderingSupport()); |
| 201 | 201 |
| 202 GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID()
; | 202 GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID()
; |
| 203 | 203 |
| 204 this->flushPathStencilSettings(stencilSettings); | 204 this->flushPathStencilSettings(stencilSettings); |
| 205 SkASSERT(!fHWPathStencilSettings.isTwoSided()); | 205 SkASSERT(!fHWPathStencilSettings.isTwoSided()); |
| 206 | 206 |
| 207 const SkStrokeRec& stroke = pathRange->getStroke(); | 207 const SkStrokeRec& stroke = pathRange->getStroke(); |
| 208 | 208 |
| 209 GrGLenum fillMode = | 209 GrGLenum fillMode = |
| 210 gr_stencil_op_to_gl_path_rendering_fill_mode( | 210 gr_stencil_op_to_gl_path_rendering_fill_mode( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); | 253 coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); |
| 254 } | 254 } |
| 255 | 255 |
| 256 GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components,
coefficients)); | 256 GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components,
coefficients)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix, | 259 void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix, |
| 260 const SkISize& renderTargetSize, | 260 const SkISize& renderTargetSize, |
| 261 GrSurfaceOrigin renderTargetOrigin)
{ | 261 GrSurfaceOrigin renderTargetOrigin)
{ |
| 262 | 262 |
| 263 SkASSERT(fGpu->glCaps().pathRenderingSupport()); | 263 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); |
| 264 | 264 |
| 265 if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin && | 265 if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin && |
| 266 renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize && | 266 renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize && |
| 267 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { | 267 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) { |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 | 270 |
| 271 fHWProjectionMatrixState.fViewMatrix = matrix; | 271 fHWProjectionMatrixState.fViewMatrix = matrix; |
| 272 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; | 272 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; |
| 273 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; | 273 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 reference, mask, coverMode,
transformType, | 385 reference, mask, coverMode,
transformType, |
| 386 transformValues)); | 386 transformValues)); |
| 387 return; | 387 return; |
| 388 } | 388 } |
| 389 | 389 |
| 390 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 390 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
| 391 reference, mask, transformType, transform
Values)); | 391 reference, mask, transformType, transform
Values)); |
| 392 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 392 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
| 393 coverMode, transformType, transformValues))
; | 393 coverMode, transformType, transformValues))
; |
| 394 } | 394 } |
| OLD | NEW |