diff options
author | Cary Clark <cary@android.com> | 2010-08-23 11:03:29 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2010-08-23 11:03:29 -0400 |
commit | f4717388475ba93a902b06746b139bc289f7b0cb (patch) | |
tree | c79b49595f2dc7969d54d6dde6a6c6f2dc876eec | |
parent | e4f33b798e088fbc8f00d6300716be1d24dda0de (diff) | |
download | external_webkit-f4717388475ba93a902b06746b139bc289f7b0cb.zip external_webkit-f4717388475ba93a902b06746b139bc289f7b0cb.tar.gz external_webkit-f4717388475ba93a902b06746b139bc289f7b0cb.tar.bz2 |
Complete implementation of PathAndroid.cpp
Completing the implementation fixes these bugs
http://b/2941002
http://b/2869593
Change-Id: I7bf8964bd91c86c89d7d29007c9a33647c399080
-rw-r--r-- | WebCore/platform/graphics/android/PathAndroid.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/WebCore/platform/graphics/android/PathAndroid.cpp b/WebCore/platform/graphics/android/PathAndroid.cpp index 13bd888..5b7e019 100644 --- a/WebCore/platform/graphics/android/PathAndroid.cpp +++ b/WebCore/platform/graphics/android/PathAndroid.cpp @@ -30,6 +30,8 @@ #include "FloatRect.h" #include "GraphicsContext.h" #include "ImageBuffer.h" +#include "PlatformGraphicsContext.h" +#include "SkiaUtils.h" #include "SkPaint.h" #include "SkPath.h" #include "SkRegion.h" @@ -77,7 +79,11 @@ bool Path::hasCurrentPoint() const FloatPoint Path::currentPoint() const { - // FIXME: Return current point of subpath. See b/2869593 + if (hasCurrentPoint()) { + SkPoint lastPt; + m_path->getLastPt(&lastPt); + return lastPt; + } float quietNaN = std::numeric_limits<float>::quiet_NaN(); return FloatPoint(quietNaN, quietNaN); } @@ -354,17 +360,6 @@ static FloatRect boundingBoxForCurrentStroke(GraphicsContext* context) return FloatRect(SkScalarToFloat(r.fLeft), SkScalarToFloat(r.fTop), SkScalarToFloat(r.width()), SkScalarToFloat(r.height())); } - -static GraphicsContext* scratchContext() -{ - static ImageBuffer* scratch = 0; - // TODO(benm): Confirm with reed that it's correct to use the (default) DeviceRGB ColorSpace parameter in the call to create below. - if (!scratch) - 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(); -} FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) { @@ -384,15 +379,13 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) #if ENABLE(SVG) bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const { -#if 0 - ASSERT(applier); GraphicsContext* scratch = scratchContext(); scratch->save(); applier->strokeStyle(scratch); SkPaint paint; - scratch->platformContext()->setupPaintForStroking(&paint, 0, 0); + scratch->setupStrokePaint(&paint); SkPath strokePath; paint.getFillPath(*platformPath(), &strokePath); bool contains = SkPathContainsPoint(&strokePath, point, @@ -400,10 +393,6 @@ bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) scratch->restore(); return contains; -#else - // FIXME: - return false; -#endif } #endif |