Changeset 148069 in webkit
- Timestamp:
- Apr 9, 2013 5:17:04 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148068 r148069 1 2013-04-09 Joone Hur <joone.hur@intel.com> 2 3 [GTK][AC] Adding contentsLayer for image and video 4 https://bugs.webkit.org/show_bug.cgi?id=113912 5 6 Reviewed by Gustavo Noronha Silva. 7 8 contentsLayer is a ClutterActor, which is added to the main layer 9 as a child when GraphicsLayer needs to render an image or video. 10 11 No new tests, already covered by existing AC tests. 12 13 * platform/graphics/clutter/GraphicsLayerActor.cpp: 14 (graphicsLayerActorUpdateTexture): 15 * platform/graphics/clutter/GraphicsLayerClutter.cpp: 16 (WebCore::GraphicsLayerClutter::GraphicsLayerClutter): 17 (WebCore::GraphicsLayerClutter::~GraphicsLayerClutter): 18 (WebCore): 19 (WebCore::GraphicsLayerClutter::setContentsToImage): Pass a Cairo surface to GraphicsLayer. 20 (WebCore::GraphicsLayerClutter::setContentsNeedsDisplay): 21 (WebCore::GraphicsLayerClutter::setContentsRect): 22 (WebCore::GraphicsLayerClutter::commitLayerChangesBeforeSublayers): 23 (WebCore::GraphicsLayerClutter::setupContentsLayer): 24 (WebCore::GraphicsLayerClutter::updateContentsImage): Set the Cairo surface for contentsLayer 25 to upload it as a texture. 26 (WebCore::GraphicsLayerClutter::updateContentsNeedsDisplay): 27 (WebCore::GraphicsLayerClutter::updateContentsRect): 28 (WebCore::GraphicsLayerClutter::updateSublayerList): 29 * platform/graphics/clutter/GraphicsLayerClutter.h: 30 (WebCore::GraphicsLayerClutter::hasContentsLayer): 31 (GraphicsLayerClutter): 32 (WebCore::GraphicsLayerClutter::contentsLayer): 33 1 34 2013-04-09 Alexey Proskuryakov <ap@apple.com> 2 35 -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp
r147443 r148069 2 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2011, 2012, 2013 Collabora Ltd. 4 * Copyright (C) 2012 Intel Corporation. All rights reserved.4 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 253 253 GraphicsLayerClutter::GraphicsLayerClutter(GraphicsLayerClient* client) 254 254 : GraphicsLayer(client) 255 , m_contentsLayerPurpose(NoContentsLayer) 255 256 , m_uncommittedChanges(0) 256 257 { … … 304 305 g_idle_add(idleDestroy, m_structuralLayer.leakRef()); 305 306 } 307 308 if (m_contentsLayer) { 309 graphicsLayerActorSetClient(m_contentsLayer.get(), 0); 310 g_idle_add(idleDestroy, m_contentsLayer.leakRef()); 311 } 306 312 } 307 313 … … 416 422 GraphicsLayer::setDrawsContent(drawsContent); 417 423 noteLayerPropertyChanged(DrawsContentChanged); 424 } 425 426 427 void GraphicsLayerClutter::setContentsToImage(Image* image) 428 { 429 if (image) { 430 RefPtr<cairo_surface_t> newImage = image->nativeImageForCurrentFrame(); 431 if (!newImage) 432 return; 433 434 m_pendingContentsImage = newImage; 435 436 m_contentsLayerPurpose = ContentsLayerForImage; 437 if (!m_contentsLayer) 438 noteSublayersChanged(); 439 } else { 440 m_pendingContentsImage = 0; 441 m_contentsLayerPurpose = NoContentsLayer; 442 if (m_contentsLayer) 443 noteSublayersChanged(); 444 } 445 446 noteLayerPropertyChanged(ContentsImageChanged); 447 } 448 449 void GraphicsLayerClutter::setContentsNeedsDisplay() 450 { 451 noteLayerPropertyChanged(ContentsNeedsDisplay); 452 } 453 454 void GraphicsLayerClutter::setContentsRect(const IntRect& rect) 455 { 456 if (rect == m_contentsRect) 457 return; 458 459 GraphicsLayer::setContentsRect(rect); 460 noteLayerPropertyChanged(ContentsRectChanged); 418 461 } 419 462 … … 643 686 updateStructuralLayer(); 644 687 688 if (m_uncommittedChanges & NameChanged) 689 updateLayerNames(); 690 691 if (m_uncommittedChanges & ContentsImageChanged) // Needs to happen before ChildrenChanged 692 updateContentsImage(); 693 694 if (m_uncommittedChanges & ChildrenChanged) 695 updateSublayerList(); 696 645 697 if (m_uncommittedChanges & GeometryChanged) 646 698 updateGeometry(pageScaleFactor, positionRelativeToBase); … … 663 715 if (m_uncommittedChanges & DirtyRectsChanged) 664 716 repaintLayerDirtyRects(); 717 718 if (m_uncommittedChanges & ContentsRectChanged) 719 updateContentsRect(); 720 721 if (m_uncommittedChanges & ContentsNeedsDisplay) 722 updateContentsNeedsDisplay(); 665 723 666 724 if (m_uncommittedChanges & ChildrenChanged) { … … 670 728 } 671 729 } 730 731 void GraphicsLayerClutter::setupContentsLayer(GraphicsLayerActor* contentsLayer) 732 { 733 graphicsLayerActorSetAnchorPoint(contentsLayer, 0.0, 0.0, 0.0); 734 } 735 736 void GraphicsLayerClutter::updateContentsImage() 737 { 738 if (m_pendingContentsImage) { 739 if (!m_contentsLayer) { 740 m_contentsLayer = graphicsLayerActorNewWithClient(LayerTypeLayer, this); 741 clutter_actor_set_name(CLUTTER_ACTOR(m_contentsLayer.get()), "Image Layer"); 742 setupContentsLayer(m_contentsLayer.get()); 743 } 744 745 graphicsLayerActorSetSurface(GRAPHICS_LAYER_ACTOR(m_contentsLayer.get()), m_pendingContentsImage.get()); 746 m_pendingContentsImage = 0; 747 748 updateContentsRect(); 749 } else { 750 // No image. 751 // m_contentsLayer will be removed via updateSublayerList. 752 m_contentsLayer = 0; 753 } 754 } 755 756 void GraphicsLayerClutter::updateContentsNeedsDisplay() 757 { 758 if (m_contentsLayer) 759 graphicsLayerActorInvalidateRectangle(m_contentsLayer.get(), FloatRect(FloatPoint(0, 0), size())); 760 } 761 762 void GraphicsLayerClutter::updateContentsRect() 763 { 764 if (!m_contentsLayer) 765 return; 766 767 FloatPoint point(m_contentsRect.x(), m_contentsRect.y()); 768 FloatRect rect(0, 0, m_contentsRect.width(), m_contentsRect.height()); 769 770 clutter_actor_set_position(CLUTTER_ACTOR(m_contentsLayer.get()), point.x(), point.y()); 771 clutter_actor_set_size(CLUTTER_ACTOR(m_contentsLayer.get()), rect.width(), rect.height()); 772 } 773 672 774 673 775 void GraphicsLayerClutter::updateGeometry(float pageScaleFactor, const FloatPoint& positionRelativeToBase) … … 696 798 if (m_structuralLayer) 697 799 structuralLayerChildren.append(m_layer); 800 801 if (m_contentsLayer) 802 primaryLayerChildren.append(m_contentsLayer); 698 803 699 804 const Vector<GraphicsLayer*>& childLayers = children(); -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
r147443 r148069 2 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2011, 2012 Collabora Ltd. 4 * Copyright (C) 2012 Intel Corporation. All rights reserved.4 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 79 79 virtual void setNeedsDisplay(); 80 80 virtual void setNeedsDisplayInRect(const FloatRect&); 81 virtual void setContentsNeedsDisplay(); 82 83 virtual void setContentsToImage(Image*); 84 virtual void setContentsRect(const IntRect&); 85 86 virtual bool hasContentsLayer() const { return m_contentsLayer; } 81 87 82 88 virtual void setPreserves3D(bool); … … 108 114 109 115 void updateOpacityOnLayer(); 116 void setupContentsLayer(GraphicsLayerActor*); 117 GraphicsLayerActor* contentsLayer() const { return m_contentsLayer.get(); } 110 118 111 119 virtual void platformClutterLayerAnimationStarted(double beginTime); … … 183 191 void updateTransform(); 184 192 void updateLayerDrawsContent(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase); 185 193 void updateContentsImage(); 194 void updateContentsRect(); 195 void updateContentsNeedsDisplay(); 186 196 void updateAnimations(); 187 197 … … 198 208 GRefPtr<GraphicsLayerActor> m_layer; 199 209 GRefPtr<GraphicsLayerActor> m_structuralLayer; // A layer used for structural reasons, like preserves-3d or replica-flattening. Is the parent of m_layer. 210 GRefPtr<GraphicsLayerActor> m_contentsLayer; // A layer used for inner content, like image and video 211 enum ContentsLayerPurpose { 212 NoContentsLayer = 0, 213 ContentsLayerForImage, 214 ContentsLayerForMedia, 215 ContentsLayerForCanvas, 216 ContentsLayerForBackgroundColor 217 }; 218 219 ContentsLayerPurpose m_contentsLayerPurpose; 220 RefPtr<cairo_surface_t> m_pendingContentsImage; 200 221 201 222 Vector<FloatRect> m_dirtyRects;
Note: See TracChangeset
for help on using the changeset viewer.