diff options
author | Ben Murdoch <benm@google.com> | 2010-07-22 15:37:06 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-07-27 10:20:25 +0100 |
commit | 967717af5423377c967781471ee106e2bb4e11c8 (patch) | |
tree | 1e701dc0a12f7f07cce1df4a7681717de77a211b /WebCore/platform/graphics/skia | |
parent | dcc30a9fca45f634b1d3a12b276d3a0ccce99fc3 (diff) | |
download | external_webkit-967717af5423377c967781471ee106e2bb4e11c8.zip external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.gz external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.bz2 |
Merge WebKit at r63859 : Initial merge by git.
Change-Id: Ie8096c63ec7c991c9a9cba8bdd9c3b74a3b8ed62
Diffstat (limited to 'WebCore/platform/graphics/skia')
-rw-r--r-- | WebCore/platform/graphics/skia/ImageBufferSkia.cpp | 5 | ||||
-rw-r--r-- | WebCore/platform/graphics/skia/PathSkia.cpp | 7 | ||||
-rw-r--r-- | WebCore/platform/graphics/skia/SkiaUtils.cpp | 12 |
3 files changed, 21 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 912fd12..f8192fe 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -74,7 +74,10 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b // Make the background transparent. It would be nice if this wasn't // required, but the canvas is currently filled with the magic transparency // color. Can we have another way to manage this? - m_data.m_canvas.drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode); + // + // Avoid drawing on a zero-sized canvas. Skia can't handle it. + if (!size.isZero()) + m_data.m_canvas.drawARGB(0, 0, 0, 0, SkXfermode::kClear_Mode); success = true; } diff --git a/WebCore/platform/graphics/skia/PathSkia.cpp b/WebCore/platform/graphics/skia/PathSkia.cpp index a0d4c79..12241f8 100644 --- a/WebCore/platform/graphics/skia/PathSkia.cpp +++ b/WebCore/platform/graphics/skia/PathSkia.cpp @@ -74,6 +74,13 @@ bool Path::hasCurrentPoint() const return m_path->getPoints(NULL, 0) != 0; } +FloatPoint Path::currentPoint() const +{ + // FIXME: return current point of subpath. + float quietNaN = std::numeric_limits<float>::quiet_NaN(); + return FloatPoint(quietNaN, quietNaN); +} + bool Path::contains(const FloatPoint& point, WindRule rule) const { return SkPathContainsPoint(m_path, point, diff --git a/WebCore/platform/graphics/skia/SkiaUtils.cpp b/WebCore/platform/graphics/skia/SkiaUtils.cpp index 0c6b2d6..b16a344 100644 --- a/WebCore/platform/graphics/skia/SkiaUtils.cpp +++ b/WebCore/platform/graphics/skia/SkiaUtils.cpp @@ -129,10 +129,18 @@ static U8CPU InvScaleByte(U8CPU component, uint32_t scale) SkColor SkPMColorToColor(SkPMColor pm) { - if (0 == pm) + if (!pm) return 0; - unsigned a = SkGetPackedA32(pm); + if (!a) { + // A zero alpha value when there are non-zero R, G, or B channels is an + // invalid premultiplied color (since all channels should have been + // multiplied by 0 if a=0). + SkASSERT(false); + // In production, return 0 to protect against division by zero. + return 0; + } + uint32_t scale = (255 << 16) / a; return SkColorSetARGB(a, |