Skip to content
Permalink
Browse files
Added OpaqueRegionSkia::currentTrackingOpaqueRect
[chromium] Add OpaqueRegionSkia::currentTrackingOpaqueRect
https://bugs.webkit.org/show_bug.cgi?id=106267

Reviewed by Stephen White.

No new tests needed. No change in functionality.

* platform/graphics/skia/OpaqueRegionSkia.cpp:
(WebCore::OpaqueRegionSkia::applyOpaqueRegionFromLayer):
(WebCore::OpaqueRegionSkia::markRectAsOpaque):
(WebCore::OpaqueRegionSkia::markRectAsNonOpaque):
(WebCore::OpaqueRegionSkia::markAllAsNonOpaque):
(WebCore::OpaqueRegionSkia::currentTrackingOpaqueRect):
(WebCore):
* platform/graphics/skia/OpaqueRegionSkia.h:
(OpaqueRegionSkia):


Canonical link: https://commits.webkit.org/124539@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139083 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alokp-chromium committed Jan 8, 2013
1 parent fbe84e4 commit 1ed1565a761724fdd3bfa66596859d8cfaafaad1
Showing 3 changed files with 33 additions and 12 deletions.
@@ -1,3 +1,24 @@
2013-01-08 Alok Priyadarshi <alokp@chromium.org>

Added OpaqueRegionSkia::currentTrackingOpaqueRect

[chromium] Add OpaqueRegionSkia::currentTrackingOpaqueRect
https://bugs.webkit.org/show_bug.cgi?id=106267

Reviewed by Stephen White.

No new tests needed. No change in functionality.

* platform/graphics/skia/OpaqueRegionSkia.cpp:
(WebCore::OpaqueRegionSkia::applyOpaqueRegionFromLayer):
(WebCore::OpaqueRegionSkia::markRectAsOpaque):
(WebCore::OpaqueRegionSkia::markRectAsNonOpaque):
(WebCore::OpaqueRegionSkia::markAllAsNonOpaque):
(WebCore::OpaqueRegionSkia::currentTrackingOpaqueRect):
(WebCore):
* platform/graphics/skia/OpaqueRegionSkia.h:
(OpaqueRegionSkia):

2013-01-08 Zan Dobersek <zandobersek@gmail.com>

[GTK] Build failures when building with python 3.3
@@ -164,14 +164,6 @@ static inline bool getDeviceClipAsRect(const PlatformContextSkia* context, SkRec
return true;
}

static inline SkRect& currentTrackingOpaqueRect(SkRect& rootOpaqueRect, Vector<OpaqueRegionSkia::CanvasLayerState, 3>& canvasLayerStack)
{
// If we are drawing into a canvas layer, then track the opaque rect in that layer.
if (!canvasLayerStack.isEmpty())
return canvasLayerStack.last().opaqueRect;
return rootOpaqueRect;
}

void OpaqueRegionSkia::pushCanvasLayer(const SkPaint* paint)
{
CanvasLayerState state;
@@ -333,7 +325,7 @@ void OpaqueRegionSkia::applyOpaqueRegionFromLayer(const PlatformContextSkia* con

SkRect sourceOpaqueRect = layerOpaqueRect;
// Save the opaque area in the destination, so we can preserve the parts of it under the source opaque area if possible.
SkRect destinationOpaqueRect = currentTrackingOpaqueRect(m_opaqueRect, m_canvasLayerStack);
SkRect destinationOpaqueRect = currentTrackingOpaqueRect();

bool outsideSourceOpaqueRectPreservesOpaque = xfermodePreservesOpaque(paint, false);
if (!outsideSourceOpaqueRectPreservesOpaque)
@@ -363,7 +355,7 @@ void OpaqueRegionSkia::markRectAsOpaque(const SkRect& rect)
// rectangle then we do that, as that is the cheapest way to increase the area returned
// without increasing the complexity.

SkRect& opaqueRect = currentTrackingOpaqueRect(m_opaqueRect, m_canvasLayerStack);
SkRect& opaqueRect = currentTrackingOpaqueRect();

if (rect.isEmpty())
return;
@@ -397,7 +389,7 @@ void OpaqueRegionSkia::markRectAsNonOpaque(const SkRect& rect)
// We want to keep as much of the current opaque rectangle as we can, so find the one largest
// rectangle inside m_opaqueRect that does not intersect with |rect|.

SkRect& opaqueRect = currentTrackingOpaqueRect(m_opaqueRect, m_canvasLayerStack);
SkRect& opaqueRect = currentTrackingOpaqueRect();

if (!SkRect::Intersects(rect, opaqueRect))
return;
@@ -432,8 +424,14 @@ void OpaqueRegionSkia::markRectAsNonOpaque(const SkRect& rect)

void OpaqueRegionSkia::markAllAsNonOpaque()
{
SkRect& opaqueRect = currentTrackingOpaqueRect(m_opaqueRect, m_canvasLayerStack);
SkRect& opaqueRect = currentTrackingOpaqueRect();
opaqueRect.setEmpty();
}

SkRect& OpaqueRegionSkia::currentTrackingOpaqueRect()
{
// If we are drawing into a canvas layer, then track the opaque rect in that layer.
return m_canvasLayerStack.isEmpty() ? m_opaqueRect : m_canvasLayerStack.last().opaqueRect;
}

} // namespace WebCore
@@ -91,6 +91,8 @@ class OpaqueRegionSkia {
void markRectAsNonOpaque(const SkRect&);
void markAllAsNonOpaque();

SkRect& currentTrackingOpaqueRect();

SkRect m_opaqueRect;

Vector<CanvasLayerState, 3> m_canvasLayerStack;

0 comments on commit 1ed1565

Please sign in to comment.