diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-07-17 13:55:50 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2012-07-17 13:55:50 -0700 |
commit | 7853e9d8b1baa5eac14017534d445e04694a0d58 (patch) | |
tree | 45e4ef101886032428c481b0f31d98499d99eae5 | |
parent | fd894788ef8b998bee0cff476afe0960220ca92c (diff) | |
download | external_webkit-7853e9d8b1baa5eac14017534d445e04694a0d58.zip external_webkit-7853e9d8b1baa5eac14017534d445e04694a0d58.tar.gz external_webkit-7853e9d8b1baa5eac14017534d445e04694a0d58.tar.bz2 |
Fix bounding box calculations
Change-Id: I71b309c96cedefee66b9b7100e483c934e198085
-rw-r--r-- | Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp | 26 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp index 001e1de..ba7f1a9 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp @@ -219,14 +219,14 @@ void PlatformGraphicsContextRecording::restore() PlatformGraphicsContext::restore(); RecordingState state = mRecordingStateStack.last(); mRecordingStateStack.removeLast(); - if (state.mHasDrawing) - appendDrawingOperation(state.mSaveOperation, state.mBounds); - else - delete state.mSaveOperation; if (mRecordingStateStack.size()) mCurrentMatrix = &(mRecordingStateStack.last().mMatrix); else mCurrentMatrix = &mRootMatrix; + if (state.mHasDrawing) + appendDrawingOperation(state.mSaveOperation, state.mBounds); + else + delete state.mSaveOperation; } //************************************** @@ -392,16 +392,14 @@ void PlatformGraphicsContextRecording::canvasClip(const Path& path) bool PlatformGraphicsContextRecording::clip(const FloatRect& rect) { - if (mRecordingStateStack.size()) - mRecordingStateStack.last().clip(rect); + clipState(rect); appendStateOperation(new GraphicsOperation::Clip(rect)); return true; } bool PlatformGraphicsContextRecording::clip(const Path& path) { - if (mRecordingStateStack.size()) - mRecordingStateStack.last().clip(path.boundingRect()); + clipState(path.boundingRect()); appendStateOperation(new GraphicsOperation::ClipPath(path)); return true; } @@ -427,8 +425,7 @@ bool PlatformGraphicsContextRecording::clipOut(const Path& path) bool PlatformGraphicsContextRecording::clipPath(const Path& pathToClip, WindRule clipRule) { - if (mRecordingStateStack.size()) - mRecordingStateStack.last().clip(pathToClip.boundingRect()); + clipState(pathToClip.boundingRect()); GraphicsOperation::ClipPath* operation = new GraphicsOperation::ClipPath(pathToClip); operation->setWindRule(clipRule); appendStateOperation(operation); @@ -571,6 +568,15 @@ void PlatformGraphicsContextRecording::strokeRect(const FloatRect& rect, float l appendDrawingOperation(new GraphicsOperation::StrokeRect(rect, lineWidth), bounds); } +void PlatformGraphicsContextRecording::clipState(const FloatRect& clip) +{ + if (mRecordingStateStack.size()) { + SkRect mapBounds; + mCurrentMatrix->mapRect(&mapBounds, clip); + mRecordingStateStack.last().clip(mapBounds); + } +} + void PlatformGraphicsContextRecording::appendDrawingOperation( GraphicsOperation::Operation* operation, const FloatRect& untranslatedBounds) { diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h index 38eb58f..3affff3 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h @@ -142,6 +142,7 @@ private: return false; } + void clipState(const FloatRect& clip); void appendDrawingOperation(GraphicsOperation::Operation* operation, const FloatRect& bounds); void appendStateOperation(GraphicsOperation::Operation* operation); void onCurrentMatrixChanged(); |