blob: bf29b6444f4810abda7ae5dd31b16e216ef9adf9 [file] [log] [blame]
* Copyright 2017 Google Inc.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
#ifndef GrCCQuadraticShader_DEFINED
#define GrCCQuadraticShader_DEFINED
#include "ccpr/GrCCCoverageProcessor.h"
* This class renders the coverage of closed quadratic curves using the techniques outlined in
* "Resolution Independent Curve Rendering using Programmable Graphics Hardware" by Charles Loop and
* Jim Blinn:
* The provided curves must be monotonic with respect to the vector of their closing edge [P2 - P0].
* (Use GrCCGeometry::quadraticTo().)
class GrCCQuadraticShader : public GrCCCoverageProcessor::Shader {
void emitSetupCode(GrGLSLVertexGeoBuilder*, const char* pts, const char* wind,
const char** outHull4) const override;
void onEmitVaryings(GrGLSLVaryingHandler*, GrGLSLVarying::Scope, SkString* code,
const char* position, const char* coverage,
const char* cornerCoverage) override;
void onEmitFragmentCode(GrGLSLFPFragmentBuilder*, const char* outputCoverage) const override;
void calcHullCoverage(SkString* code, const char* coordAndGrad, const char* d,
const char* outputCoverage) const;
const GrShaderVar fQCoordMatrix{"qcoord_matrix", kFloat2x2_GrSLType};
const GrShaderVar fQCoord0{"qcoord0", kFloat2_GrSLType};
const GrShaderVar fEdgeDistanceEquation{"edge_distance_equation", kFloat3_GrSLType};
GrGLSLVarying fCoord_fGrad;
GrGLSLVarying fEdge_fWind_fCorner;