Changeset 269936 in webkit
- Timestamp:
- Nov 17, 2020 4:49:46 PM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269932 r269936 1 2020-11-17 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 Use SetForScope to temporarily change members of TextureMapperPaintOptions instead of copying all members 4 https://bugs.webkit.org/show_bug.cgi?id=219022 5 6 Reviewed by Carlos Garcia Campos. 7 8 All members of TextureMapperPaintOptions don't need to be copied 9 just to change some members. Use WTF::SetForScope to temporarily 10 change members of TextureMapperPaintOptions. 11 12 No behavior changes. 13 14 * platform/graphics/texmap/TextureMapperLayer.cpp: 15 (WebCore::TextureMapperLayer::paintSelf): 16 (WebCore::TextureMapperLayer::paintSelfAndChildren): 17 (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica): 18 (WebCore::TextureMapperLayer::paintUsingOverlapRegions): 19 (WebCore::TextureMapperLayer::applyMask): 20 (WebCore::TextureMapperLayer::paintIntoSurface): 21 (WebCore::commitSurface): 22 (WebCore::TextureMapperLayer::paintWithIntermediateSurface): 23 (WebCore::TextureMapperLayer::paintRecursive): 24 * platform/graphics/texmap/TextureMapperLayer.h: 25 1 26 2020-11-17 Megan Gardner <megan_gardner@apple.com> 2 27 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
r269837 r269936 25 25 #include "Region.h" 26 26 #include <wtf/MathExtras.h> 27 #include <wtf/SetForScope.h> 27 28 28 29 namespace WebCore { … … 152 153 } 153 154 154 void TextureMapperLayer::paintSelf( constTextureMapperPaintOptions& options)155 void TextureMapperLayer::paintSelf(TextureMapperPaintOptions& options) 155 156 { 156 157 if (!m_state.visible || !m_state.contentsVisible) … … 219 220 } 220 221 221 void TextureMapperLayer::paintSelfAndChildren( constTextureMapperPaintOptions& options)222 void TextureMapperLayer::paintSelfAndChildren(TextureMapperPaintOptions& options) 222 223 { 223 224 if (m_state.backdropLayer && m_state.backdropLayer == options.backdropLayer) … … 295 296 } 296 297 297 void TextureMapperLayer::paintSelfAndChildrenWithReplica( constTextureMapperPaintOptions& options)298 void TextureMapperLayer::paintSelfAndChildrenWithReplica(TextureMapperPaintOptions& options) 298 299 { 299 300 if (m_state.replicaLayer) { 300 TextureMapperPaintOptions replicaOptions(options);301 replicaOptions.transform.multiply(replicaTransform());302 paintSelfAndChildren( replicaOptions);301 SetForScope<TransformationMatrix> scopedTransform(options.transform, options.transform); 302 options.transform.multiply(replicaTransform()); 303 paintSelfAndChildren(options); 303 304 } 304 305 … … 368 369 } 369 370 370 void TextureMapperLayer::paintUsingOverlapRegions( constTextureMapperPaintOptions& options)371 void TextureMapperLayer::paintUsingOverlapRegions(TextureMapperPaintOptions& options) 371 372 { 372 373 Region overlapRegion; … … 422 423 } 423 424 424 void TextureMapperLayer::applyMask( constTextureMapperPaintOptions& options)425 void TextureMapperLayer::applyMask(TextureMapperPaintOptions& options) 425 426 { 426 427 options.textureMapper.setMaskMode(true); … … 433 434 options.textureMapper.bindSurface(options.surface.get()); 434 435 if (m_isBackdrop) { 435 TextureMapperPaintOptions paintOptions(options); 436 paintOptions.transform = TransformationMatrix(); 437 paintOptions.backdropLayer = this; 438 rootLayer().paintSelfAndChildren(paintOptions); 436 SetForScope<TransformationMatrix> scopedTransform(options.transform, TransformationMatrix()); 437 SetForScope<TextureMapperLayer*> scopedBackdropLayer(options.backdropLayer, this); 438 rootLayer().paintSelfAndChildren(options); 439 439 } else 440 440 paintSelfAndChildren(options); … … 445 445 } 446 446 447 static void commitSurface( constTextureMapperPaintOptions& options, BitmapTexture& surface, const IntRect& rect, float opacity)447 static void commitSurface(TextureMapperPaintOptions& options, BitmapTexture& surface, const IntRect& rect, float opacity) 448 448 { 449 449 IntRect targetRect(rect); … … 453 453 } 454 454 455 void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOptions& options, const IntRect& rect) 456 { 457 TextureMapperPaintOptions paintOptions(options); 458 paintOptions.surface = options.textureMapper.acquireTextureFromPool(rect.size(), BitmapTexture::SupportsAlpha); 459 paintOptions.offset = -toIntSize(rect.location()); 460 paintOptions.opacity = 1; 461 if (m_state.replicaLayer) { 462 paintOptions.transform.multiply(replicaTransform()); 463 paintIntoSurface(paintOptions); 464 paintOptions.transform = options.transform; 465 if (m_state.replicaLayer->m_state.maskLayer) 466 m_state.replicaLayer->m_state.maskLayer->applyMask(paintOptions); 467 } 468 469 paintIntoSurface(paintOptions); 470 471 commitSurface(options, *paintOptions.surface, rect, options.opacity); 472 } 473 474 void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options) 455 void TextureMapperLayer::paintWithIntermediateSurface(TextureMapperPaintOptions& options, const IntRect& rect) 456 { 457 auto surface = options.textureMapper.acquireTextureFromPool(rect.size(), BitmapTexture::SupportsAlpha); 458 { 459 SetForScope<RefPtr<BitmapTexture>> scopedSurface(options.surface, surface); 460 SetForScope<IntSize> scopedOffset(options.offset, -toIntSize(rect.location())); 461 SetForScope<float> scopedOpacity(options.opacity, 1); 462 if (m_state.replicaLayer) { 463 { 464 SetForScope<TransformationMatrix> scopedTransform(options.transform, options.transform); 465 options.transform.multiply(replicaTransform()); 466 paintIntoSurface(options); 467 } 468 if (m_state.replicaLayer->m_state.maskLayer) 469 m_state.replicaLayer->m_state.maskLayer->applyMask(options); 470 } 471 472 paintIntoSurface(options); 473 surface = options.surface; 474 } 475 476 commitSurface(options, *surface, rect, options.opacity); 477 } 478 479 void TextureMapperLayer::paintRecursive(TextureMapperPaintOptions& options) 475 480 { 476 481 if (!isVisible()) 477 482 return; 478 483 479 TextureMapperPaintOptions paintOptions(options); 480 paintOptions.opacity *= m_currentOpacity; 484 SetForScope<float> scopedOpacity(options.opacity, options.opacity * m_currentOpacity); 481 485 482 486 if (!shouldBlend()) { 483 paintSelfAndChildrenWithReplica( paintOptions);484 return; 485 } 486 487 paintUsingOverlapRegions( paintOptions);487 paintSelfAndChildrenWithReplica(options); 488 return; 489 } 490 491 paintUsingOverlapRegions(options); 488 492 } 489 493 -
trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
r269772 r269936 137 137 void computeOverlapRegions(ComputeOverlapRegionData&, const TransformationMatrix&, bool includesReplica = true); 138 138 139 void paintRecursive( constTextureMapperPaintOptions&);140 void paintUsingOverlapRegions( constTextureMapperPaintOptions&);139 void paintRecursive(TextureMapperPaintOptions&); 140 void paintUsingOverlapRegions(TextureMapperPaintOptions&); 141 141 void paintIntoSurface(TextureMapperPaintOptions&); 142 void paintWithIntermediateSurface( constTextureMapperPaintOptions&, const IntRect&);143 void paintSelf( constTextureMapperPaintOptions&);144 void paintSelfAndChildren( constTextureMapperPaintOptions&);145 void paintSelfAndChildrenWithReplica( constTextureMapperPaintOptions&);146 void applyMask( constTextureMapperPaintOptions&);142 void paintWithIntermediateSurface(TextureMapperPaintOptions&, const IntRect&); 143 void paintSelf(TextureMapperPaintOptions&); 144 void paintSelfAndChildren(TextureMapperPaintOptions&); 145 void paintSelfAndChildrenWithReplica(TextureMapperPaintOptions&); 146 void applyMask(TextureMapperPaintOptions&); 147 147 148 148 bool isVisible() const;
Note: See TracChangeset
for help on using the changeset viewer.