aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-01-25 11:05:01 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-25 16:37:59 +0000
commit58abc9e2c56464336472493745e91133819deb96 (patch)
treea9bc4cdab83eb6f265f40865f25173735a9f2287 /src
parentde80f7f35d472c03ce882ec31434e59c002f58db (diff)
Move SkShadowTessellator to GrShadowTessellator
BUG=skia:6119 Change-Id: I9756b5aeaced1f21a65063470ccb013c7b856f28 Reviewed-on: https://skia-review.googlesource.com/7505 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/effects/shadows/SkAmbientShadowMaskFilter.cpp4
-rwxr-xr-xsrc/gpu/effects/GrShadowTessellator.cpp (renamed from src/effects/shadows/SkShadowTessellator.cpp)29
-rwxr-xr-xsrc/gpu/effects/GrShadowTessellator.h (renamed from src/effects/shadows/SkShadowTessellator.h)11
3 files changed, 19 insertions, 25 deletions
diff --git a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
index e378c184b9..d92a7b548c 100755
--- a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
+++ b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
@@ -18,11 +18,11 @@
#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
@@ -238,7 +238,7 @@ bool SkAmbientShadowMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texPr
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);
diff --git a/src/effects/shadows/SkShadowTessellator.cpp b/src/gpu/effects/GrShadowTessellator.cpp
index 0a320ceba9..8aa91e2f40 100755
--- a/src/effects/shadows/SkShadowTessellator.cpp
+++ b/src/gpu/effects/GrShadowTessellator.cpp
@@ -5,12 +5,11 @@
* 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;
@@ -40,7 +39,7 @@ static void compute_radial_steps(const SkVector& v1, const SkVector& v2, SkScala
*n = SkScalarFloorToInt(steps);
}
-SkAmbientShadowTessellator::SkAmbientShadowTessellator(const SkMatrix& viewMatrix,
+GrAmbientShadowTessellator::GrAmbientShadowTessellator(const SkMatrix& viewMatrix,
const SkPath& path,
SkScalar radius,
GrColor umbraColor,
@@ -144,7 +143,7 @@ static const SkScalar kQuadTolerance = 0.2f;
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;
@@ -197,12 +196,12 @@ void SkAmbientShadowTessellator::handleLine(const SkPoint& p) {
}
}
-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();
@@ -214,12 +213,12 @@ void SkAmbientShadowTessellator::handleQuad(const SkPoint pts[3]) {
}
}
-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);
@@ -232,7 +231,7 @@ void SkAmbientShadowTessellator::handleCubic(const SkMatrix& m, SkPoint pts[4])
}
}
-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);
@@ -249,7 +248,7 @@ void SkAmbientShadowTessellator::handleConic(const SkMatrix& m, SkPoint pts[3],
}
}
-void SkAmbientShadowTessellator::addArc(const SkVector& nextNormal) {
+void GrAmbientShadowTessellator::addArc(const SkVector& nextNormal) {
// fill in fan from previous quad
SkScalar rotSin, rotCos;
int numSteps;
@@ -270,7 +269,7 @@ void SkAmbientShadowTessellator::addArc(const SkVector& nextNormal) {
}
-void SkAmbientShadowTessellator::finishArcAndAddEdge(const SkPoint& nextPoint,
+void GrAmbientShadowTessellator::finishArcAndAddEdge(const SkPoint& nextPoint,
const SkVector& nextNormal) {
// close out previous arc
*fPositions.push() = fPositions[fPrevInnerIndex] + nextNormal;
@@ -282,7 +281,7 @@ void SkAmbientShadowTessellator::finishArcAndAddEdge(const SkPoint& nextPoint,
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;
@@ -310,5 +309,3 @@ void SkAmbientShadowTessellator::addEdge(const SkPoint& nextPoint, const SkVecto
fPrevInnerIndex = fPositions.count() - 2;
fPrevNormal = nextNormal;
}
-
-#endif
diff --git a/src/effects/shadows/SkShadowTessellator.h b/src/gpu/effects/GrShadowTessellator.h
index 91274340df..6d42f496f7 100755
--- a/src/effects/shadows/SkShadowTessellator.h
+++ b/src/gpu/effects/GrShadowTessellator.h
@@ -5,13 +5,12 @@
* 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;
@@ -22,9 +21,9 @@ class SkPath;
* 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(); }
@@ -71,5 +70,3 @@ private:
};
#endif
-
-#endif