summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-07-17 14:08:14 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-17 14:08:14 -0700
commitd12967fd535d36a592841c6c4bb112bd94092b3c (patch)
tree2f7400d773a5dfd348595ef4b4a65784b81cc11c /Source/WebCore/platform
parent9333e3ffe2337c3b4b6ee209bdbe3900a1e8a16d (diff)
parent7853e9d8b1baa5eac14017534d445e04694a0d58 (diff)
downloadexternal_webkit-d12967fd535d36a592841c6c4bb112bd94092b3c.zip
external_webkit-d12967fd535d36a592841c6c4bb112bd94092b3c.tar.gz
external_webkit-d12967fd535d36a592841c6c4bb112bd94092b3c.tar.bz2
Merge "Fix bounding box calculations"
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp26
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h1
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();