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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void GrGLPathRendering::resetContext() { | 76 void GrGLPathRendering::resetContext() { |
77 fHWProjectionMatrixState.invalidate(); | 77 fHWProjectionMatrixState.invalidate(); |
78 // we don't use the model view matrix. | 78 // we don't use the model view matrix. |
79 GL_CALL(MatrixLoadIdentity(GR_GL_PATH_MODELVIEW)); | 79 GL_CALL(MatrixLoadIdentity(GR_GL_PATH_MODELVIEW)); |
80 | 80 |
81 fHWPathStencilSettings.invalidate(); | 81 fHWPathStencilSettings.invalidate(); |
82 } | 82 } |
83 | 83 |
84 GrPath* GrGLPathRendering::createPath(const SkPath& inPath, const GrStrokeInfo&
stroke) { | 84 GrPath* GrGLPathRendering::createPath(const SkPath& inPath, const GrStrokeInfo&
stroke) { |
85 return SkNEW_ARGS(GrGLPath, (this->gpu(), inPath, stroke)); | 85 return new GrGLPath(this->gpu(), inPath, stroke); |
86 } | 86 } |
87 | 87 |
88 GrPathRange* GrGLPathRendering::createPathRange(GrPathRange::PathGenerator* path
Generator, | 88 GrPathRange* GrGLPathRendering::createPathRange(GrPathRange::PathGenerator* path
Generator, |
89 const GrStrokeInfo& stroke) { | 89 const GrStrokeInfo& stroke) { |
90 return SkNEW_ARGS(GrGLPathRange, (this->gpu(), pathGenerator, stroke)); | 90 return new GrGLPathRange(this->gpu(), pathGenerator, stroke); |
91 } | 91 } |
92 | 92 |
93 void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
path) { | 93 void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
path) { |
94 GrGLGpu* gpu = this->gpu(); | 94 GrGLGpu* gpu = this->gpu(); |
95 SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport()); | 95 SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport()); |
96 gpu->flushColorWrite(false); | 96 gpu->flushColorWrite(false); |
97 gpu->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); | 97 gpu->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
98 | 98 |
99 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fRenderTarget); | 99 GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fRenderTarget); |
100 SkISize size = SkISize::Make(rt->width(), rt->height()); | 100 SkISize size = SkISize::Make(rt->width(), rt->height()); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
238 | 238 |
239 if (NULL == fPathNameAllocator.get()) { | 239 if (NULL == fPathNameAllocator.get()) { |
240 static const int range = 65536; | 240 static const int range = 65536; |
241 GrGLuint firstName; | 241 GrGLuint firstName; |
242 GL_CALL_RET(firstName, GenPaths(range)); | 242 GL_CALL_RET(firstName, GenPaths(range)); |
243 fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (firstName, first
Name + range))); | 243 fPathNameAllocator.reset(new GrGLNameAllocator(firstName, firstName + ra
nge)); |
244 } | 244 } |
245 | 245 |
246 // When allocating names one at a time, pull from a client-side pool of | 246 // When allocating names one at a time, pull from a client-side pool of |
247 // available names in order to save a round trip to the GL server. | 247 // available names in order to save a round trip to the GL server. |
248 GrGLuint name = fPathNameAllocator->allocateName(); | 248 GrGLuint name = fPathNameAllocator->allocateName(); |
249 | 249 |
250 if (0 == name) { | 250 if (0 == name) { |
251 // Our reserved path names are all in use. Fall back on GenPaths. | 251 // Our reserved path names are all in use. Fall back on GenPaths. |
252 GL_CALL_RET(name, GenPaths(1)); | 252 GL_CALL_RET(name, GenPaths(1)); |
253 } | 253 } |
(...skipping 35 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 |