aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--expectations/gm/ignored-tests.txt2
-rw-r--r--gm/hairlines.cpp49
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp8
3 files changed, 34 insertions, 25 deletions
diff --git a/expectations/gm/ignored-tests.txt b/expectations/gm/ignored-tests.txt
index 6c93e7af88..c271714659 100644
--- a/expectations/gm/ignored-tests.txt
+++ b/expectations/gm/ignored-tests.txt
@@ -72,3 +72,5 @@ pictureimagefilter
clipped-bitmap-shaders-clamp
clipped-bitmap-shaders-clamp-hq
+#joshualitt
+hairlines
diff --git a/gm/hairlines.cpp b/gm/hairlines.cpp
index e017d8b22d..df67412dfe 100644
--- a/gm/hairlines.cpp
+++ b/gm/hairlines.cpp
@@ -22,7 +22,7 @@ protected:
return SkString("hairlines");
}
- virtual SkISize onISize() { return SkISize::Make(800, 600); }
+ virtual SkISize onISize() { return SkISize::Make(1250, 1250); }
virtual void onOnceBeforeDraw() SK_OVERRIDE {
{
@@ -166,6 +166,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
static const SkAlpha kAlphaValue[] = { 0xFF, 0x40 };
+ static const SkScalar kWidths[] = { 0, 0.5f, 1.5f };
enum {
kMargin = 5,
@@ -180,32 +181,34 @@ protected:
for (int p = 0; p < fPaths.count(); ++p) {
for (size_t a = 0; a < SK_ARRAY_COUNT(kAlphaValue); ++a) {
for (int aa = 0; aa < 2; ++aa) {
- const SkRect& bounds = fPaths[p].getBounds();
+ for (size_t w = 0; w < SK_ARRAY_COUNT(kWidths); w++) {
+ const SkRect& bounds = fPaths[p].getBounds();
+
+ if (x + bounds.width() > wrapX) {
+ canvas->restore();
+ canvas->translate(0, maxH + SkIntToScalar(kMargin));
+ canvas->save();
+ maxH = 0;
+ x = SkIntToScalar(kMargin);
+ }
+
+ SkPaint paint;
+ paint.setARGB(kAlphaValue[a], 0, 0, 0);
+ paint.setAntiAlias(SkToBool(aa));
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(kWidths[w]);
- if (x + bounds.width() > wrapX) {
- canvas->restore();
- canvas->translate(0, maxH + SkIntToScalar(kMargin));
canvas->save();
- maxH = 0;
- x = SkIntToScalar(kMargin);
- }
-
- SkPaint paint;
- paint.setARGB(kAlphaValue[a], 0, 0, 0);
- paint.setAntiAlias(SkToBool(aa));
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(0);
-
- canvas->save();
- canvas->translate(-bounds.fLeft, -bounds.fTop);
- canvas->drawPath(fPaths[p], paint);
- canvas->restore();
+ canvas->translate(-bounds.fLeft, -bounds.fTop);
+ canvas->drawPath(fPaths[p], paint);
+ canvas->restore();
- maxH = SkMaxScalar(maxH, bounds.height());
+ maxH = SkMaxScalar(maxH, bounds.height());
- SkScalar dx = bounds.width() + SkIntToScalar(kMargin);
- x += dx;
- canvas->translate(dx, 0);
+ SkScalar dx = bounds.width() + SkIntToScalar(kMargin);
+ x += dx;
+ canvas->translate(dx, 0);
+ }
}
}
}
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 8ea03fbba7..daa0b6ba06 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -237,9 +237,13 @@ void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr
if (GrProgramDesc::kAttribute_ColorInput == header.fColorInput) {
*inputColor = outputColor;
}
- if (GrProgramDesc::kUniform_ColorInput != header.fCoverageInput) {
- *inputCoverage = outputCoverage;
+
+ // We may have uniform coverage, if so we need to multiply the GPs output by the uniform
+ // coverage
+ if (GrProgramDesc::kUniform_ColorInput == header.fCoverageInput) {
+ fFS.codeAppendf("%s *= %s;", outputCoverage.c_str(), inputCoverage->c_str());
}
+ *inputCoverage = outputCoverage;
}
fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));