diff options
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 32 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.h | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index c0851dd..b0c2629 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -349,6 +349,38 @@ bool LayerAndroid::prepareContext(bool force) return m_recordingPicture; } +SkRect LayerAndroid::subtractLayers(const SkRect& visibleRect) const +{ + SkRect result; + if (m_recordingPicture) { + SkRect globalRect = bounds(); + globalRect.offset(-getPosition()); // localToGlobal adds in position + SkMatrix globalMatrix; + localToGlobal(&globalMatrix); + globalMatrix.mapRect(&globalRect); + SkIRect roundedGlobal; + globalRect.round(&roundedGlobal); + SkIRect iVisibleRect; + visibleRect.round(&iVisibleRect); + SkRegion visRegion(iVisibleRect); + visRegion.op(roundedGlobal, SkRegion::kDifference_Op); + result.set(visRegion.getBounds()); +#if DEBUG_NAV_UI + SkDebugf("%s visibleRect=(%g,%g,r=%g,b=%g) globalRect=(%g,%g,r=%g,b=%g)" + "result=(%g,%g,r=%g,b=%g)", __FUNCTION__, + visibleRect.fLeft, visibleRect.fTop, + visibleRect.fRight, visibleRect.fBottom, + globalRect.fLeft, globalRect.fTop, + globalRect.fRight, globalRect.fBottom, + result.fLeft, result.fTop, result.fRight, result.fBottom); +#endif + } else + result = visibleRect; + for (int i = 0; i < countChildren(); i++) + result = getChild(i)->subtractLayers(result); + return result; +} + // Debug tools : dump the layers tree in a file. // The format is simple: // properties have the form: key = value; diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 3cd7e36..2554fb9 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -119,6 +119,10 @@ public: SkPicture* picture() const { return m_recordingPicture; } + // remove layers bounds from visible rectangle to show what can be + // scrolled into view; returns original minus layer bounds in global space. + SkRect subtractLayers(const SkRect& visibleRect) const; + void dumpLayers(FILE*, int indentLevel) const; void dumpToLog() const; |