Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (148019 => 148020)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2013-04-09 13:45:14 UTC (rev 148019)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2013-04-09 14:13:30 UTC (rev 148020)
@@ -77,7 +77,7 @@
// Reorder children if needed on the way back up.
if (m_state.preserves3D)
- sortByZOrder(m_children, 0, m_children.size());
+ sortByZOrder(m_children);
}
void TextureMapperLayer::paint()
@@ -110,9 +110,8 @@
transform.multiply(options.transform);
transform.multiply(m_currentTransform.combined());
- float opacity = options.opacity;
if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty()) {
- options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, opacity));
+ options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, options.opacity));
if (m_state.showDebugBorders)
options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
return;
@@ -121,7 +120,7 @@
if (m_backingStore) {
ASSERT(m_state.drawsContent && m_state.contentsVisible && !m_state.size.isEmpty());
ASSERT(!layerRect().isEmpty());
- m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, opacity);
+ m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, options.opacity);
if (m_state.showDebugBorders)
m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
// Only draw repaint count for the main backing store.
@@ -131,7 +130,7 @@
if (m_contentsLayer) {
ASSERT(!layerRect().isEmpty());
- m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, opacity);
+ m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity);
if (m_state.showDebugBorders)
m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
}
@@ -144,7 +143,7 @@
return int(((*layerA)->m_centerZ - (*layerB)->m_centerZ) * 1000);
}
-void TextureMapperLayer::sortByZOrder(Vector<TextureMapperLayer* >& array, int /* first */, int /* last */)
+void TextureMapperLayer::sortByZOrder(Vector<TextureMapperLayer* >& array)
{
qsort(array.data(), array.size(), sizeof(TextureMapperLayer*), compareGraphicsLayersZValue);
}
@@ -262,7 +261,7 @@
nonOverlapRegion.unite(newRegion);
}
-void TextureMapperLayer::computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, bool alwaysResolveSelfOverlap)
+void TextureMapperLayer::computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode mode)
{
if (!m_state.visible || !m_state.contentsVisible)
return;
@@ -305,8 +304,7 @@
if (!m_state.masksToBounds) {
for (size_t i = 0; i < m_children.size(); ++i) {
TextureMapperLayer* child = m_children[i];
- bool alwaysResolveSelfOverlapForChildren = false;
- child->computeOverlapRegions(newOverlapRegion, newNonOverlapRegion, alwaysResolveSelfOverlapForChildren);
+ child->computeOverlapRegions(newOverlapRegion, newNonOverlapRegion, ResolveSelfOverlapIfNeeded);
}
}
@@ -316,7 +314,7 @@
resolveOverlaps(replicaRegion, newOverlapRegion, newNonOverlapRegion);
}
- if (!alwaysResolveSelfOverlap && shouldBlend()) {
+ if ((mode != ResolveSelfOverlapAlways) && shouldBlend()) {
newNonOverlapRegion.unite(newOverlapRegion);
newOverlapRegion = Region();
}
@@ -329,7 +327,7 @@
{
Region overlapRegion;
Region nonOverlapRegion;
- computeOverlapRegions(overlapRegion, nonOverlapRegion);
+ computeOverlapRegions(overlapRegion, nonOverlapRegion, ResolveSelfOverlapAlways);
if (overlapRegion.isEmpty()) {
paintSelfAndChildrenWithReplica(options);
return;
@@ -344,8 +342,9 @@
rects = overlapRegion.rects();
IntSize maxTextureSize = options.textureMapper->maxTextureSize();
+ IntRect rect;
for (size_t i = 0; i < rects.size(); ++i) {
- IntRect rect = rects[i];
+ rect = rects[i];
for (int x = rect.x(); x < rect.maxX(); x += maxTextureSize.width()) {
for (int y = rect.y(); y < rect.maxY(); y += maxTextureSize.height()) {
IntRect tileRect(IntPoint(x, y), maxTextureSize);
@@ -378,14 +377,13 @@
return surface;
}
-static PassRefPtr<BitmapTexture> commitSurface(const TextureMapperPaintOptions& options, PassRefPtr<BitmapTexture> surface, const IntRect& rect, float opacity)
+static void commitSurface(const TextureMapperPaintOptions& options, PassRefPtr<BitmapTexture> surface, const IntRect& rect, float opacity)
{
options.textureMapper->bindSurface(options.surface.get());
TransformationMatrix targetTransform;
targetTransform.translate(options.offset.width(), options.offset.height());
targetTransform.multiply(options.transform);
options.textureMapper->drawTexture(*surface.get(), rect, targetTransform, opacity);
- return 0;
}
void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOptions& options, const IntRect& rect)
@@ -404,8 +402,10 @@
m_state.replicaLayer->m_state.maskLayer->applyMask(paintOptions);
}
- if (replicaSurface && options.opacity == 1)
- replicaSurface = commitSurface(options, replicaSurface, rect, 1);
+ if (replicaSurface && options.opacity == 1) {
+ commitSurface(options, replicaSurface, rect, 1);
+ replicaSurface.clear();
+ }
mainSurface = paintIntoSurface(paintOptions, rect.size());
if (replicaSurface) {
@@ -423,7 +423,7 @@
return;
TextureMapperPaintOptions paintOptions(options);
- paintOptions.opacity = options.opacity * m_currentOpacity;
+ paintOptions.opacity *= m_currentOpacity;
if (!shouldBlend()) {
paintSelfAndChildrenWithReplica(paintOptions);
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (148019 => 148020)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2013-04-09 13:45:14 UTC (rev 148019)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2013-04-09 14:13:30 UTC (rev 148020)
@@ -126,7 +126,7 @@
void computeTransformsRecursive();
static int compareGraphicsLayersZValue(const void* a, const void* b);
- static void sortByZOrder(Vector<TextureMapperLayer* >& array, int first, int last);
+ static void sortByZOrder(Vector<TextureMapperLayer* >& array);
PassRefPtr<BitmapTexture> texture() { return m_backingStore ? m_backingStore->texture() : 0; }
FloatPoint adjustedPosition() const { return m_state.pos + m_scrollPositionDelta - m_userScrollOffset; }
@@ -136,7 +136,11 @@
void removeFromParent();
void removeAllChildren();
- void computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, bool alwaysResolveSelfOverlap = true);
+ enum ResolveSelfOverlapMode {
+ ResolveSelfOverlapAlways = 0,
+ ResolveSelfOverlapIfNeeded
+ };
+ void computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode);
void paintRecursive(const TextureMapperPaintOptions&);
void paintUsingOverlapRegions(const TextureMapperPaintOptions&);