From e17c07e1e68f5c798f2ba207f14cc21825f0582a Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 31 Oct 2011 13:48:54 +1300 Subject: [PATCH] Bug 688366 - Fix Skia marking radial gradients with the same radius as invalid. r=jrmuizel --- gfx/skia/radial-gradients.patch | 25 +++++++++++++++++++++++ gfx/skia/src/effects/SkGradientShader.cpp | 5 ++++- gfx/skia/update.sh | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gfx/skia/radial-gradients.patch diff --git a/gfx/skia/radial-gradients.patch b/gfx/skia/radial-gradients.patch new file mode 100644 index 00000000000..eca14d5c8b1 --- /dev/null +++ b/gfx/skia/radial-gradients.patch @@ -0,0 +1,25 @@ +diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp +--- a/gfx/skia/src/effects/SkGradientShader.cpp ++++ b/gfx/skia/src/effects/SkGradientShader.cpp +@@ -1652,17 +1652,20 @@ public: + } + return kRadial2_GradientType; + } + + virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) { + SkASSERT(count > 0); + + // Zero difference between radii: fill with transparent black. +- if (fDiffRadius == 0) { ++ // TODO: Is removing this actually correct? Two circles with the ++ // same radius, but different centers doesn't sound like it ++ // should be cleared ++ if (fDiffRadius == 0 && fCenter1 == fCenter2) { + sk_bzero(dstC, count * sizeof(*dstC)); + return; + } + SkMatrix::MapXYProc dstProc = fDstToIndexProc; + TileProc proc = fTileProc; + const SkPMColor* SK_RESTRICT cache = this->getCache32(); + + SkScalar foura = fA * 4; diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp index 1103e8b14c1..57b94890d25 100644 --- a/gfx/skia/src/effects/SkGradientShader.cpp +++ b/gfx/skia/src/effects/SkGradientShader.cpp @@ -1657,7 +1657,10 @@ public: SkASSERT(count > 0); // Zero difference between radii: fill with transparent black. - if (fDiffRadius == 0) { + // TODO: Is removing this actually correct? Two circles with the + // same radius, but different centers doesn't sound like it + // should be cleared + if (fDiffRadius == 0 && fCenter1 == fCenter2) { sk_bzero(dstC, count * sizeof(*dstC)); return; } diff --git a/gfx/skia/update.sh b/gfx/skia/update.sh index 0184fbb2b02..868c61cb360 100755 --- a/gfx/skia/update.sh +++ b/gfx/skia/update.sh @@ -101,3 +101,5 @@ patch -p3 < fix-gradient-clamp.patch patch -p3 < getpostextpath.patch # Bug 688365 - Enable Skia 'New AA' mode. patch -p3 < new-aa.patch +# Bug 688366 - Fix Skia marking radial gradients with the same radius as invalid. +patch -p3 < radial-gradients.patch