michael@0: diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp michael@0: --- a/gfx/skia/src/effects/SkGradientShader.cpp michael@0: +++ b/gfx/skia/src/effects/SkGradientShader.cpp michael@0: @@ -1184,116 +1184,17 @@ public: michael@0: { michael@0: // make sure our table is insync with our current #define for kSQRT_TABLE_SIZE michael@0: SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE); michael@0: michael@0: rad_to_unit_matrix(center, radius, &fPtsToUnit); michael@0: } michael@0: michael@0: virtual void shadeSpan(int x, int y, SkPMColor* dstC, int count) SK_OVERRIDE; michael@0: - virtual void shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) SK_OVERRIDE { michael@0: - SkASSERT(count > 0); michael@0: - michael@0: - SkPoint srcPt; michael@0: - SkMatrix::MapXYProc dstProc = fDstToIndexProc; michael@0: - TileProc proc = fTileProc; michael@0: - const uint16_t* SK_RESTRICT cache = this->getCache16(); michael@0: - int toggle = ((x ^ y) & 1) << kCache16Bits; michael@0: - michael@0: - if (fDstToIndexClass != kPerspective_MatrixClass) { michael@0: - dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, michael@0: - SkIntToScalar(y) + SK_ScalarHalf, &srcPt); michael@0: - SkFixed dx, fx = SkScalarToFixed(srcPt.fX); michael@0: - SkFixed dy, fy = SkScalarToFixed(srcPt.fY); michael@0: - michael@0: - if (fDstToIndexClass == kFixedStepInX_MatrixClass) { michael@0: - SkFixed storage[2]; michael@0: - (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]); michael@0: - dx = storage[0]; michael@0: - dy = storage[1]; michael@0: - } else { michael@0: - SkASSERT(fDstToIndexClass == kLinear_MatrixClass); michael@0: - dx = SkScalarToFixed(fDstToIndex.getScaleX()); michael@0: - dy = SkScalarToFixed(fDstToIndex.getSkewY()); michael@0: - } michael@0: - michael@0: - if (proc == clamp_tileproc) { michael@0: - const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table; michael@0: - michael@0: - /* knock these down so we can pin against +- 0x7FFF, which is an immediate load, michael@0: - rather than 0xFFFF which is slower. This is a compromise, since it reduces our michael@0: - precision, but that appears to be visually OK. If we decide this is OK for michael@0: - all of our cases, we could (it seems) put this scale-down into fDstToIndex, michael@0: - to avoid having to do these extra shifts each time. michael@0: - */ michael@0: - fx >>= 1; michael@0: - dx >>= 1; michael@0: - fy >>= 1; michael@0: - dy >>= 1; michael@0: - if (dy == 0) { // might perform this check for the other modes, but the win will be a smaller % of the total michael@0: - fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: - fy *= fy; michael@0: - do { michael@0: - unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: - unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS); michael@0: - fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS)); michael@0: - fx += dx; michael@0: - *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))]; michael@0: - toggle ^= (1 << kCache16Bits); michael@0: - } while (--count != 0); michael@0: - } else { michael@0: - do { michael@0: - unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: - unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: - fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS); michael@0: - fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS)); michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))]; michael@0: - toggle ^= (1 << kCache16Bits); michael@0: - } while (--count != 0); michael@0: - } michael@0: - } else if (proc == mirror_tileproc) { michael@0: - do { michael@0: - SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy)); michael@0: - unsigned fi = mirror_tileproc(dist); michael@0: - SkASSERT(fi <= 0xFFFF); michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))]; michael@0: - toggle ^= (1 << kCache16Bits); michael@0: - } while (--count != 0); michael@0: - } else { michael@0: - SkASSERT(proc == repeat_tileproc); michael@0: - do { michael@0: - SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy)); michael@0: - unsigned fi = repeat_tileproc(dist); michael@0: - SkASSERT(fi <= 0xFFFF); michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))]; michael@0: - toggle ^= (1 << kCache16Bits); michael@0: - } while (--count != 0); michael@0: - } michael@0: - } else { // perspective case michael@0: - SkScalar dstX = SkIntToScalar(x); michael@0: - SkScalar dstY = SkIntToScalar(y); michael@0: - do { michael@0: - dstProc(fDstToIndex, dstX, dstY, &srcPt); michael@0: - unsigned fi = proc(SkScalarToFixed(srcPt.length())); michael@0: - SkASSERT(fi <= 0xFFFF); michael@0: - michael@0: - int index = fi >> (16 - kCache16Bits); michael@0: - *dstC++ = cache[toggle + index]; michael@0: - toggle ^= (1 << kCache16Bits); michael@0: - michael@0: - dstX += SK_Scalar1; michael@0: - } while (--count != 0); michael@0: - } michael@0: - } michael@0: + virtual void shadeSpan16(int x, int y, uint16_t* dstC, int count) SK_OVERRIDE; michael@0: michael@0: virtual BitmapType asABitmap(SkBitmap* bitmap, michael@0: SkMatrix* matrix, michael@0: TileMode* xy, michael@0: SkScalar* twoPointRadialParams) const SK_OVERRIDE { michael@0: if (bitmap) { michael@0: this->commonAsABitmap(bitmap); michael@0: } michael@0: @@ -1507,16 +1408,117 @@ void Radial_Gradient::shadeSpan(int x, i michael@0: unsigned fi = proc(SkScalarToFixed(srcPt.length())); michael@0: SkASSERT(fi <= 0xFFFF); michael@0: *dstC++ = cache[fi >> (16 - kCache32Bits)]; michael@0: dstX += SK_Scalar1; michael@0: } while (--count != 0); michael@0: } michael@0: } michael@0: michael@0: +void Radial_Gradient::shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) { michael@0: + SkASSERT(count > 0); michael@0: + michael@0: + SkPoint srcPt; michael@0: + SkMatrix::MapXYProc dstProc = fDstToIndexProc; michael@0: + TileProc proc = fTileProc; michael@0: + const uint16_t* SK_RESTRICT cache = this->getCache16(); michael@0: + int toggle = ((x ^ y) & 1) << kCache16Bits; michael@0: + michael@0: + if (fDstToIndexClass != kPerspective_MatrixClass) { michael@0: + dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, michael@0: + SkIntToScalar(y) + SK_ScalarHalf, &srcPt); michael@0: + SkFixed dx, fx = SkScalarToFixed(srcPt.fX); michael@0: + SkFixed dy, fy = SkScalarToFixed(srcPt.fY); michael@0: + michael@0: + if (fDstToIndexClass == kFixedStepInX_MatrixClass) { michael@0: + SkFixed storage[2]; michael@0: + (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]); michael@0: + dx = storage[0]; michael@0: + dy = storage[1]; michael@0: + } else { michael@0: + SkASSERT(fDstToIndexClass == kLinear_MatrixClass); michael@0: + dx = SkScalarToFixed(fDstToIndex.getScaleX()); michael@0: + dy = SkScalarToFixed(fDstToIndex.getSkewY()); michael@0: + } michael@0: + michael@0: + if (proc == clamp_tileproc) { michael@0: + const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table; michael@0: + michael@0: + /* knock these down so we can pin against +- 0x7FFF, which is an immediate load, michael@0: + rather than 0xFFFF which is slower. This is a compromise, since it reduces our michael@0: + precision, but that appears to be visually OK. If we decide this is OK for michael@0: + all of our cases, we could (it seems) put this scale-down into fDstToIndex, michael@0: + to avoid having to do these extra shifts each time. michael@0: + */ michael@0: + fx >>= 1; michael@0: + dx >>= 1; michael@0: + fy >>= 1; michael@0: + dy >>= 1; michael@0: + if (dy == 0) { // might perform this check for the other modes, but the win will be a smaller % of the total michael@0: + fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: + fy *= fy; michael@0: + do { michael@0: + unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: + unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS); michael@0: + fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS)); michael@0: + fx += dx; michael@0: + *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))]; michael@0: + toggle ^= (1 << kCache16Bits); michael@0: + } while (--count != 0); michael@0: + } else { michael@0: + do { michael@0: + unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: + unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1); michael@0: + fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS); michael@0: + fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS)); michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))]; michael@0: + toggle ^= (1 << kCache16Bits); michael@0: + } while (--count != 0); michael@0: + } michael@0: + } else if (proc == mirror_tileproc) { michael@0: + do { michael@0: + SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy)); michael@0: + unsigned fi = mirror_tileproc(dist); michael@0: + SkASSERT(fi <= 0xFFFF); michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))]; michael@0: + toggle ^= (1 << kCache16Bits); michael@0: + } while (--count != 0); michael@0: + } else { michael@0: + SkASSERT(proc == repeat_tileproc); michael@0: + do { michael@0: + SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy)); michael@0: + unsigned fi = repeat_tileproc(dist); michael@0: + SkASSERT(fi <= 0xFFFF); michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))]; michael@0: + toggle ^= (1 << kCache16Bits); michael@0: + } while (--count != 0); michael@0: + } michael@0: + } else { // perspective case michael@0: + SkScalar dstX = SkIntToScalar(x); michael@0: + SkScalar dstY = SkIntToScalar(y); michael@0: + do { michael@0: + dstProc(fDstToIndex, dstX, dstY, &srcPt); michael@0: + unsigned fi = proc(SkScalarToFixed(srcPt.length())); michael@0: + SkASSERT(fi <= 0xFFFF); michael@0: + michael@0: + int index = fi >> (16 - kCache16Bits); michael@0: + *dstC++ = cache[toggle + index]; michael@0: + toggle ^= (1 << kCache16Bits); michael@0: + michael@0: + dstX += SK_Scalar1; michael@0: + } while (--count != 0); michael@0: + } michael@0: +} michael@0: + michael@0: /* Two-point radial gradients are specified by two circles, each with a center michael@0: point and radius. The gradient can be considered to be a series of michael@0: concentric circles, with the color interpolated from the start circle michael@0: (at t=0) to the end circle (at t=1). michael@0: michael@0: For each point (x, y) in the span, we want to find the michael@0: interpolated circle that intersects that point. The center michael@0: of the desired circle (Cx, Cy) falls at some distance t michael@0: @@ -1661,109 +1663,17 @@ public: michael@0: info->fPoint[0] = fCenter1; michael@0: info->fPoint[1] = fCenter2; michael@0: info->fRadius[0] = fRadius1; michael@0: info->fRadius[1] = fRadius2; michael@0: } michael@0: return kRadial2_GradientType; michael@0: } michael@0: michael@0: - virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) SK_OVERRIDE { michael@0: - SkASSERT(count > 0); michael@0: - michael@0: - // Zero difference between radii: fill with transparent black. michael@0: - // TODO: Is removing this actually correct? Two circles with the michael@0: - // same radius, but different centers doesn't sound like it michael@0: - // should be cleared michael@0: - if (fDiffRadius == 0 && fCenter1 == fCenter2) { michael@0: - sk_bzero(dstC, count * sizeof(*dstC)); michael@0: - return; michael@0: - } michael@0: - SkMatrix::MapXYProc dstProc = fDstToIndexProc; michael@0: - TileProc proc = fTileProc; michael@0: - const SkPMColor* SK_RESTRICT cache = this->getCache32(); michael@0: - michael@0: - SkScalar foura = fA * 4; michael@0: - bool posRoot = fDiffRadius < 0; michael@0: - if (fDstToIndexClass != kPerspective_MatrixClass) { michael@0: - SkPoint srcPt; michael@0: - dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, michael@0: - SkIntToScalar(y) + SK_ScalarHalf, &srcPt); michael@0: - SkScalar dx, fx = srcPt.fX; michael@0: - SkScalar dy, fy = srcPt.fY; michael@0: - michael@0: - if (fDstToIndexClass == kFixedStepInX_MatrixClass) { michael@0: - SkFixed fixedX, fixedY; michael@0: - (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY); michael@0: - dx = SkFixedToScalar(fixedX); michael@0: - dy = SkFixedToScalar(fixedY); michael@0: - } else { michael@0: - SkASSERT(fDstToIndexClass == kLinear_MatrixClass); michael@0: - dx = fDstToIndex.getScaleX(); michael@0: - dy = fDstToIndex.getSkewY(); michael@0: - } michael@0: - SkScalar b = (SkScalarMul(fDiff.fX, fx) + michael@0: - SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2; michael@0: - SkScalar db = (SkScalarMul(fDiff.fX, dx) + michael@0: - SkScalarMul(fDiff.fY, dy)) * 2; michael@0: - if (proc == clamp_tileproc) { michael@0: - for (; count > 0; --count) { michael@0: - SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: - if (t < 0) { michael@0: - *dstC++ = cache[-1]; michael@0: - } else if (t > 0xFFFF) { michael@0: - *dstC++ = cache[kCache32Count * 2]; michael@0: - } else { michael@0: - SkASSERT(t <= 0xFFFF); michael@0: - *dstC++ = cache[t >> (16 - kCache32Bits)]; michael@0: - } michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - b += db; michael@0: - } michael@0: - } else if (proc == mirror_tileproc) { michael@0: - for (; count > 0; --count) { michael@0: - SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: - SkFixed index = mirror_tileproc(t); michael@0: - SkASSERT(index <= 0xFFFF); michael@0: - *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - b += db; michael@0: - } michael@0: - } else { michael@0: - SkASSERT(proc == repeat_tileproc); michael@0: - for (; count > 0; --count) { michael@0: - SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: - SkFixed index = repeat_tileproc(t); michael@0: - SkASSERT(index <= 0xFFFF); michael@0: - *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: - fx += dx; michael@0: - fy += dy; michael@0: - b += db; michael@0: - } michael@0: - } michael@0: - } else { // perspective case michael@0: - SkScalar dstX = SkIntToScalar(x); michael@0: - SkScalar dstY = SkIntToScalar(y); michael@0: - for (; count > 0; --count) { michael@0: - SkPoint srcPt; michael@0: - dstProc(fDstToIndex, dstX, dstY, &srcPt); michael@0: - SkScalar fx = srcPt.fX; michael@0: - SkScalar fy = srcPt.fY; michael@0: - SkScalar b = (SkScalarMul(fDiff.fX, fx) + michael@0: - SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2; michael@0: - SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: - SkFixed index = proc(t); michael@0: - SkASSERT(index <= 0xFFFF); michael@0: - *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: - dstX += SK_Scalar1; michael@0: - } michael@0: - } michael@0: - } michael@0: + virtual void shadeSpan(int x, int y, SkPMColor* dstC, int count) SK_OVERRIDE; michael@0: michael@0: virtual bool setContext(const SkBitmap& device, michael@0: const SkPaint& paint, michael@0: const SkMatrix& matrix) SK_OVERRIDE { michael@0: if (!this->INHERITED::setContext(device, paint, matrix)) { michael@0: return false; michael@0: } michael@0: michael@0: @@ -1817,16 +1727,110 @@ private: michael@0: fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SK_Scalar1; michael@0: fOneOverTwoA = fA ? SkScalarInvert(fA * 2) : 0; michael@0: michael@0: fPtsToUnit.setTranslate(-fCenter1.fX, -fCenter1.fY); michael@0: fPtsToUnit.postScale(inv, inv); michael@0: } michael@0: }; michael@0: michael@0: +void Two_Point_Radial_Gradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) { michael@0: + SkASSERT(count > 0); michael@0: + michael@0: + // Zero difference between radii: fill with transparent black. michael@0: + // TODO: Is removing this actually correct? Two circles with the michael@0: + // same radius, but different centers doesn't sound like it michael@0: + // should be cleared michael@0: + if (fDiffRadius == 0 && fCenter1 == fCenter2) { michael@0: + sk_bzero(dstC, count * sizeof(*dstC)); michael@0: + return; michael@0: + } michael@0: + SkMatrix::MapXYProc dstProc = fDstToIndexProc; michael@0: + TileProc proc = fTileProc; michael@0: + const SkPMColor* SK_RESTRICT cache = this->getCache32(); michael@0: + michael@0: + SkScalar foura = fA * 4; michael@0: + bool posRoot = fDiffRadius < 0; michael@0: + if (fDstToIndexClass != kPerspective_MatrixClass) { michael@0: + SkPoint srcPt; michael@0: + dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, michael@0: + SkIntToScalar(y) + SK_ScalarHalf, &srcPt); michael@0: + SkScalar dx, fx = srcPt.fX; michael@0: + SkScalar dy, fy = srcPt.fY; michael@0: + michael@0: + if (fDstToIndexClass == kFixedStepInX_MatrixClass) { michael@0: + SkFixed fixedX, fixedY; michael@0: + (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY); michael@0: + dx = SkFixedToScalar(fixedX); michael@0: + dy = SkFixedToScalar(fixedY); michael@0: + } else { michael@0: + SkASSERT(fDstToIndexClass == kLinear_MatrixClass); michael@0: + dx = fDstToIndex.getScaleX(); michael@0: + dy = fDstToIndex.getSkewY(); michael@0: + } michael@0: + SkScalar b = (SkScalarMul(fDiff.fX, fx) + michael@0: + SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2; michael@0: + SkScalar db = (SkScalarMul(fDiff.fX, dx) + michael@0: + SkScalarMul(fDiff.fY, dy)) * 2; michael@0: + if (proc == clamp_tileproc) { michael@0: + for (; count > 0; --count) { michael@0: + SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: + if (t < 0) { michael@0: + *dstC++ = cache[-1]; michael@0: + } else if (t > 0xFFFF) { michael@0: + *dstC++ = cache[kCache32Count * 2]; michael@0: + } else { michael@0: + SkASSERT(t <= 0xFFFF); michael@0: + *dstC++ = cache[t >> (16 - kCache32Bits)]; michael@0: + } michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + b += db; michael@0: + } michael@0: + } else if (proc == mirror_tileproc) { michael@0: + for (; count > 0; --count) { michael@0: + SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: + SkFixed index = mirror_tileproc(t); michael@0: + SkASSERT(index <= 0xFFFF); michael@0: + *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + b += db; michael@0: + } michael@0: + } else { michael@0: + SkASSERT(proc == repeat_tileproc); michael@0: + for (; count > 0; --count) { michael@0: + SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: + SkFixed index = repeat_tileproc(t); michael@0: + SkASSERT(index <= 0xFFFF); michael@0: + *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: + fx += dx; michael@0: + fy += dy; michael@0: + b += db; michael@0: + } michael@0: + } michael@0: + } else { // perspective case michael@0: + SkScalar dstX = SkIntToScalar(x); michael@0: + SkScalar dstY = SkIntToScalar(y); michael@0: + for (; count > 0; --count) { michael@0: + SkPoint srcPt; michael@0: + dstProc(fDstToIndex, dstX, dstY, &srcPt); michael@0: + SkScalar fx = srcPt.fX; michael@0: + SkScalar fy = srcPt.fY; michael@0: + SkScalar b = (SkScalarMul(fDiff.fX, fx) + michael@0: + SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2; michael@0: + SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot); michael@0: + SkFixed index = proc(t); michael@0: + SkASSERT(index <= 0xFFFF); michael@0: + *dstC++ = cache[index >> (16 - kCache32Bits)]; michael@0: + dstX += SK_Scalar1; michael@0: + } michael@0: + } michael@0: +} michael@0: + michael@0: /////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: class Sweep_Gradient : public Gradient_Shader { michael@0: public: michael@0: Sweep_Gradient(SkScalar cx, SkScalar cy, const SkColor colors[], michael@0: const SkScalar pos[], int count, SkUnitMapper* mapper) michael@0: : Gradient_Shader(colors, pos, count, SkShader::kClamp_TileMode, mapper), michael@0: fCenter(SkPoint::Make(cx, cy))