OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "GrGLPathProgram.h" | |
9 #include "GrGLPathProcessor.h" | |
10 #include "GrGLGpu.h" | |
11 #include "GrPathProcessor.h" | |
12 | |
13 GrGLPathProgram::GrGLPathProgram(GrGLGpu* gpu, | |
14 const GrProgramDesc& desc, | |
15 const BuiltinUniformHandles& builtinUniforms, | |
16 GrGLuint programID, | |
17 const UniformInfoArray& uniforms, | |
18 const SeparableVaryingInfoArray& separableVaryi
ngs, | |
19 GrGLInstalledGeoProc* primProc, | |
20 GrGLInstalledXferProc* xferProcessor, | |
21 GrGLInstalledFragProcs* fragmentProcessors, | |
22 SkTArray<UniformHandle>* passSamplerUniforms) | |
23 : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, | |
24 xferProcessor, fragmentProcessors, passSamplerUniforms) | |
25 , fPathProgramDataManager(gpu, fProgramID, separableVaryings) { | |
26 } | |
27 void GrGLPathProgram::didSetData() { | |
28 GrGLPathProcessor* pathProc = | |
29 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge
t()); | |
30 pathProc->didSetData(fGpu->glPathRendering()); | |
31 } | |
32 | |
33 void GrGLPathProgram::setTransformData(const GrPrimitiveProcessor& primProc, | |
34 const GrFragmentProcessor& processor, | |
35 int index, | |
36 GrGLInstalledFragProc* ip) { | |
37 GrGLPathProcessor* pathProc = | |
38 static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.ge
t()); | |
39 pathProc->setTransformData(primProc, fPathProgramDataManager, index, | |
40 processor.coordTransforms()); | |
41 } | |
42 | |
43 void GrGLPathProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro
c, | |
44 const GrPipeline& pipeline) { | |
45 SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0); | |
46 const GrRenderTarget* rt = pipeline.getRenderTarget(); | |
47 SkISize size; | |
48 size.set(rt->width(), rt->height()); | |
49 const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); | |
50 fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(), | |
51 size, rt->origin()); | |
52 } | |
OLD | NEW |