Index: src/gpu/GrSWMaskHelper.cpp |
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp |
index c80a13ccd02aafa76e1184e2a075b0dd27cf6b8d..90aab9030faf358410ea5bff1d9eca57994b7ad3 100644 |
--- a/src/gpu/GrSWMaskHelper.cpp |
+++ b/src/gpu/GrSWMaskHelper.cpp |
@@ -12,6 +12,7 @@ |
#include "GrGpu.h" |
#include "SkData.h" |
+#include "SkDistanceFieldGen.h" |
#include "SkStrokeRec.h" |
// TODO: try to remove this #include |
@@ -306,6 +307,16 @@ void GrSWMaskHelper::toTexture(GrTexture *texture) { |
} |
} |
+/** |
+ * Convert mask generation results to a signed distance field |
+ */ |
+void GrSWMaskHelper::toSDF(unsigned char* sdf) { |
+ SkAutoLockPixels alp(fBM); |
+ |
+ SkGenerateDistanceFieldFromA8Image(sdf, (const unsigned char*)fBM.getPixels(), |
+ fBM.width(), fBM.height(), fBM.rowBytes()); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
/** |
* Software rasterizes path to A8 mask (possibly using the context's matrix) |