Index: src/gpu/gl/GrGLPathProgram.cpp |
diff --git a/src/gpu/gl/GrGLPathProgram.cpp b/src/gpu/gl/GrGLPathProgram.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8a2a20555e067537b1a4e9b5ef88939b7a46e2f1 |
--- /dev/null |
+++ b/src/gpu/gl/GrGLPathProgram.cpp |
@@ -0,0 +1,52 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "GrGLPathProgram.h" |
+#include "GrGLPathProcessor.h" |
+#include "GrGLGpu.h" |
+#include "GrPathProcessor.h" |
+ |
+GrGLPathProgram::GrGLPathProgram(GrGLGpu* gpu, |
+ const GrProgramDesc& desc, |
+ const BuiltinUniformHandles& builtinUniforms, |
+ GrGLuint programID, |
+ const UniformInfoArray& uniforms, |
+ const SeparableVaryingInfoArray& separableVaryings, |
+ GrGLInstalledGeoProc* primProc, |
+ GrGLInstalledXferProc* xferProcessor, |
+ GrGLInstalledFragProcs* fragmentProcessors, |
+ SkTArray<UniformHandle>* passSamplerUniforms) |
+ : INHERITED(gpu, desc, builtinUniforms, programID, uniforms, primProc, |
+ xferProcessor, fragmentProcessors, passSamplerUniforms) |
+ , fPathProgramDataManager(gpu, fProgramID, separableVaryings) { |
+} |
+void GrGLPathProgram::didSetData() { |
+ GrGLPathProcessor* pathProc = |
+ static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.get()); |
+ pathProc->didSetData(fGpu->glPathRendering()); |
+} |
+ |
+void GrGLPathProgram::setTransformData(const GrPrimitiveProcessor& primProc, |
+ const GrFragmentProcessor& processor, |
+ int index, |
+ GrGLInstalledFragProc* ip) { |
+ GrGLPathProcessor* pathProc = |
+ static_cast<GrGLPathProcessor*>(fGeometryProcessor.get()->fGLProc.get()); |
+ pathProc->setTransformData(primProc, fPathProgramDataManager, index, |
+ processor.coordTransforms()); |
+} |
+ |
+void GrGLPathProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primProc, |
+ const GrPipeline& pipeline) { |
+ SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0); |
+ const GrRenderTarget* rt = pipeline.getRenderTarget1(); |
+ SkISize size; |
+ size.set(rt->width(), rt->height()); |
+ const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>(); |
+ fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(), |
+ size, rt->origin()); |
+} |