Move SkShadowTessellator to GrShadowTessellator
authorJim Van Verth <jvanverth@google.com>
Wed, 25 Jan 2017 16:05:01 +0000 (11:05 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 25 Jan 2017 16:37:59 +0000 (16:37 +0000)
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>

gn/effects.gni
gn/gpu.gni
src/effects/shadows/SkAmbientShadowMaskFilter.cpp
src/gpu/effects/GrShadowTessellator.cpp [moved from src/effects/shadows/SkShadowTessellator.cpp with 93% similarity]
src/gpu/effects/GrShadowTessellator.h [moved from src/effects/shadows/SkShadowTessellator.h with 91% similarity]

index ea7dd72..b3459e3 100644 (file)
@@ -88,8 +88,6 @@ skia_effects_sources = [
   "$_src/effects/shadows/SkAmbientShadowMaskFilter.h",
   "$_src/effects/shadows/SkSpotShadowMaskFilter.cpp",
   "$_src/effects/shadows/SkSpotShadowMaskFilter.h",
-  "$_src/effects/shadows/SkShadowTessellator.cpp",
-  "$_src/effects/shadows/SkShadowTessellator.h",
 
   "$_include/effects/Sk1DPathEffect.h",
   "$_include/effects/Sk2DPathEffect.h",
index 1a0a5ae..7df3e4d 100644 (file)
@@ -327,6 +327,8 @@ skia_gpu_sources = [
   "$_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",
index e378c18..d92a7b5 100755 (executable)
 #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);
similarity index 93%
rename from src/effects/shadows/SkShadowTessellator.cpp
rename to src/gpu/effects/GrShadowTessellator.cpp
index 0a320ce..8aa91e2 100755 (executable)
@@ -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
similarity index 91%
rename from src/effects/shadows/SkShadowTessellator.h
rename to src/gpu/effects/GrShadowTessellator.h
index 9127434..6d42f49 100755 (executable)
@@ -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