diff options
author | Leon Clarke <leonclarke@google.com> | 2010-07-15 12:03:35 +0100 |
---|---|---|
committer | Leon Clarke <leonclarke@google.com> | 2010-07-20 16:57:23 +0100 |
commit | e458d70a0d18538346f41b503114c9ebe6b2ce12 (patch) | |
tree | 86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/platform/graphics/skia | |
parent | f43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff) | |
download | external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2 |
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/platform/graphics/skia')
-rw-r--r-- | WebCore/platform/graphics/skia/GradientSkia.cpp | 14 | ||||
-rw-r--r-- | WebCore/platform/graphics/skia/GraphicsContextSkia.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/graphics/skia/SkiaUtils.cpp | 4 |
3 files changed, 12 insertions, 10 deletions
diff --git a/WebCore/platform/graphics/skia/GradientSkia.cpp b/WebCore/platform/graphics/skia/GradientSkia.cpp index 7370a49..66a8976 100644 --- a/WebCore/platform/graphics/skia/GradientSkia.cpp +++ b/WebCore/platform/graphics/skia/GradientSkia.cpp @@ -154,18 +154,18 @@ SkShader* Gradient::platformGradient() if (m_radial) { // Since the two-point radial gradient is slower than the plain radial, // only use it if we have to. - if (m_p0 != m_p1) { - // The radii we give to Skia must be positive. If we're given a - // negative radius, ask for zero instead. - SkScalar radius0 = m_r0 >= 0.0f ? WebCoreFloatToSkScalar(m_r0) : 0; - SkScalar radius1 = m_r1 >= 0.0f ? WebCoreFloatToSkScalar(m_r1) : 0; - m_gradient = SkGradientShader::CreateTwoPointRadial(m_p0, radius0, m_p1, radius1, colors, pos, static_cast<int>(countUsed), tile); - } else { + if (m_p0 == m_p1 && m_r0 <= 0.0f) { // The radius we give to Skia must be positive (and non-zero). If // we're given a zero radius, just ask for a very small radius so // Skia will still return an object. SkScalar radius = m_r1 > 0 ? WebCoreFloatToSkScalar(m_r1) : SK_ScalarMin; m_gradient = SkGradientShader::CreateRadial(m_p1, radius, colors, pos, static_cast<int>(countUsed), tile); + } else { + // The radii we give to Skia must be positive. If we're given a + // negative radius, ask for zero instead. + SkScalar radius0 = m_r0 >= 0.0f ? WebCoreFloatToSkScalar(m_r0) : 0; + SkScalar radius1 = m_r1 >= 0.0f ? WebCoreFloatToSkScalar(m_r1) : 0; + m_gradient = SkGradientShader::CreateTwoPointRadial(m_p0, radius0, m_p1, radius1, colors, pos, static_cast<int>(countUsed), tile); } } else { SkPoint pts[2] = { m_p0, m_p1 }; diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 793fe72..0c1898b 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -737,6 +737,8 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (paintingDisabled()) return; + platformContext()->save(); + SkRect r = rect; if (!isRectSkiaSafe(getCTM(), r)) { // See the other version of fillRect below. @@ -746,6 +748,8 @@ void GraphicsContext::fillRect(const FloatRect& rect) SkPaint paint; platformContext()->setupPaintForFilling(&paint); platformContext()->canvas()->drawRect(r, paint); + + platformContext()->restore(); } void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace) diff --git a/WebCore/platform/graphics/skia/SkiaUtils.cpp b/WebCore/platform/graphics/skia/SkiaUtils.cpp index 377ca06..0c6b2d6 100644 --- a/WebCore/platform/graphics/skia/SkiaUtils.cpp +++ b/WebCore/platform/graphics/skia/SkiaUtils.cpp @@ -240,9 +240,7 @@ bool SkPathContainsPoint(SkPath* originalPath, const FloatPoint& point, SkPath:: GraphicsContext* scratchContext() { - static ImageBuffer* scratch = 0; - if (!scratch) - scratch = ImageBuffer::create(IntSize(1, 1)).release(); + static ImageBuffer* scratch = ImageBuffer::create(IntSize(1, 1)).leakPtr(); // We don't bother checking for failure creating the ImageBuffer, since our // ImageBuffer initializer won't fail. return scratch->context(); |