"$_src/gpu/effects/GrRRectEffect.h",
"$_src/gpu/effects/GrShadowGeoProc.cpp",
"$_src/gpu/effects/GrShadowGeoProc.h",
+ "$_src/gpu/effects/GrShadowTessellator.cpp",
+ "$_src/gpu/effects/GrShadowTessellator.h",
"$_src/gpu/effects/GrSimpleTextureEffect.cpp",
"$_src/gpu/effects/GrSimpleTextureEffect.h",
"$_src/gpu/effects/GrSingleTextureEffect.cpp",
#include "GrStyle.h"
#include "GrTexture.h"
#include "GrTextureProxy.h"
+#include "effects/GrShadowTessellator.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"
-#include "SkShadowTessellator.h"
#include "SkStrokeRec.h"
#endif
GrColor umbraColor = GrColorPackRGBA(0, 0, fAmbientAlpha*255.9999f, umbraAlpha*255.9999f);
GrColor penumbraColor = GrColorPackRGBA(0, 0, fAmbientAlpha*255.9999f, 0);
- SkAmbientShadowTessellator tess(SkMatrix::I(), path, radius, umbraColor, penumbraColor,
+ GrAmbientShadowTessellator tess(SkMatrix::I(), path, radius, umbraColor, penumbraColor,
SkToBool(fFlags & SkShadowFlags::kTransparentOccluder_ShadowFlag));
sk_sp<ShadowEdgeFP> edgeFP(new ShadowEdgeFP);
* found in the LICENSE file.
*/
-#include "SkShadowTessellator.h"
-#include "SkGeometry.h"
-
-#if SK_SUPPORT_GPU
+#include "GrShadowTessellator.h"
#include "GrPathUtils.h"
+#include "SkGeometry.h"
+
static bool compute_normal(const SkPoint& p0, const SkPoint& p1, SkScalar radius, SkScalar dir,
SkVector* newNormal) {
SkVector normal;
*n = SkScalarFloorToInt(steps);
}
-SkAmbientShadowTessellator::SkAmbientShadowTessellator(const SkMatrix& viewMatrix,
+GrAmbientShadowTessellator::GrAmbientShadowTessellator(const SkMatrix& viewMatrix,
const SkPath& path,
SkScalar radius,
GrColor umbraColor,
static const SkScalar kCubicTolerance = 0.2f;
static const SkScalar kConicTolerance = 0.5f;
-void SkAmbientShadowTessellator::handleLine(const SkPoint& p) {
+void GrAmbientShadowTessellator::handleLine(const SkPoint& p) {
if (fInitPoints.count() < 2) {
*fInitPoints.push() = p;
return;
}
}
-void SkAmbientShadowTessellator::handleLine(const SkMatrix& m, SkPoint p) {
+void GrAmbientShadowTessellator::handleLine(const SkMatrix& m, SkPoint p) {
m.mapPoints(&p, 1);
this->handleLine(p);
}
-void SkAmbientShadowTessellator::handleQuad(const SkPoint pts[3]) {
+void GrAmbientShadowTessellator::handleQuad(const SkPoint pts[3]) {
int maxCount = GrPathUtils::quadraticPointCount(pts, kQuadTolerance);
fPointBuffer.setReserve(maxCount);
SkPoint* target = fPointBuffer.begin();
}
}
-void SkAmbientShadowTessellator::handleQuad(const SkMatrix& m, SkPoint pts[3]) {
+void GrAmbientShadowTessellator::handleQuad(const SkMatrix& m, SkPoint pts[3]) {
m.mapPoints(pts, 3);
this->handleQuad(pts);
}
-void SkAmbientShadowTessellator::handleCubic(const SkMatrix& m, SkPoint pts[4]) {
+void GrAmbientShadowTessellator::handleCubic(const SkMatrix& m, SkPoint pts[4]) {
m.mapPoints(pts, 4);
int maxCount = GrPathUtils::cubicPointCount(pts, kCubicTolerance);
fPointBuffer.setReserve(maxCount);
}
}
-void SkAmbientShadowTessellator::handleConic(const SkMatrix& m, SkPoint pts[3], SkScalar w) {
+void GrAmbientShadowTessellator::handleConic(const SkMatrix& m, SkPoint pts[3], SkScalar w) {
m.mapPoints(pts, 3);
SkAutoConicToQuads quadder;
const SkPoint* quads = quadder.computeQuads(pts, w, kConicTolerance);
}
}
-void SkAmbientShadowTessellator::addArc(const SkVector& nextNormal) {
+void GrAmbientShadowTessellator::addArc(const SkVector& nextNormal) {
// fill in fan from previous quad
SkScalar rotSin, rotCos;
int numSteps;
}
-void SkAmbientShadowTessellator::finishArcAndAddEdge(const SkPoint& nextPoint,
+void GrAmbientShadowTessellator::finishArcAndAddEdge(const SkPoint& nextPoint,
const SkVector& nextNormal) {
// close out previous arc
*fPositions.push() = fPositions[fPrevInnerIndex] + nextNormal;
this->addEdge(nextPoint, nextNormal);
}
-void SkAmbientShadowTessellator::addEdge(const SkPoint& nextPoint, const SkVector& nextNormal) {
+void GrAmbientShadowTessellator::addEdge(const SkPoint& nextPoint, const SkVector& nextNormal) {
// add next quad
*fPositions.push() = nextPoint;
*fColors.push() = fUmbraColor;
fPrevInnerIndex = fPositions.count() - 2;
fPrevNormal = nextNormal;
}
-
-#endif
* found in the LICENSE file.
*/
-#ifndef SkShadowTessellator_DEFINED
-#define SkShadowTessellator_DEFINED
+#ifndef GrShadowTessellator_DEFINED
+#define GrShadowTessellator_DEFINED
#include "SkTDArray.h"
#include "SkPoint.h"
-#if SK_SUPPORT_GPU
#include "GrColor.h"
class SkMatrix;
* radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively.
* If transparent is true, then the center of the ambient shadow will be filled in.
*/
-class SkAmbientShadowTessellator {
+class GrAmbientShadowTessellator {
public:
- SkAmbientShadowTessellator(const SkMatrix& viewMatrix, const SkPath& path, SkScalar radius,
+ GrAmbientShadowTessellator(const SkMatrix& viewMatrix, const SkPath& path, SkScalar radius,
GrColor umbraColor, GrColor penumbraColor, bool transparent);
int vertexCount() { return fPositions.count(); }
};
#endif
-
-#endif