Changeset 147145 in webkit


Ignore:
Timestamp:
Mar 28, 2013 12:59:07 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][AC] Use transform property of ClutterActor
https://bugs.webkit.org/show_bug.cgi?id=113317

Patch by ChangSeok Oh <ChangSeok Oh> on 2013-03-28
Reviewed by Gustavo Noronha Silva.

ClutterActor has a transform property to set transformation matrix directly
since version 1.12. So we don't need to keep and use the matrix property of GraphicsLayerActor.

No new tests because of no functionality change.

  • platform/graphics/clutter/GraphicsLayerActor.cpp:

(_GraphicsLayerActorPrivate):
(graphicsLayerActorDispose):
(graphicsLayerActorApplyTransform):

  • platform/graphics/clutter/GraphicsLayerActor.h:
  • platform/graphics/clutter/GraphicsLayerClutter.cpp:

(WebCore::GraphicsLayerClutter::updateTransform):

  • platform/graphics/clutter/PlatformClutterAnimation.cpp:

(WebCore::PlatformClutterAnimation::addTransformTransition):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147144 r147145  
     12013-03-28  ChangSeok Oh  <changseok.oh@collabora.com>
     2
     3        [GTK][AC] Use transform property of ClutterActor
     4        https://bugs.webkit.org/show_bug.cgi?id=113317
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        ClutterActor has a transform property to set transformation matrix directly
     9        since version 1.12. So we don't need to keep and use the matrix property of GraphicsLayerActor.
     10
     11        No new tests because of no functionality change.
     12
     13        * platform/graphics/clutter/GraphicsLayerActor.cpp:
     14        (_GraphicsLayerActorPrivate):
     15        (graphicsLayerActorDispose):
     16        (graphicsLayerActorApplyTransform):
     17        * platform/graphics/clutter/GraphicsLayerActor.h:
     18        * platform/graphics/clutter/GraphicsLayerClutter.cpp:
     19        (WebCore::GraphicsLayerClutter::updateTransform):
     20        * platform/graphics/clutter/PlatformClutterAnimation.cpp:
     21        (WebCore::PlatformClutterAnimation::addTransformTransition):
     22
    1232013-03-28  Sheriff Bot  <webkit.review.bot@gmail.com>
    224
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp

    r147121 r147145  
    4242
    4343    RefPtr<cairo_surface_t> surface;
    44     CoglMatrix* matrix;
    4544
    4645    PlatformClutterLayerClient* layerClient;
     
    151150    priv->surface.clear();
    152151
    153     if (priv->matrix)
    154         cogl_matrix_free(priv->matrix);
    155 
    156152    G_OBJECT_CLASS(graphics_layer_actor_parent_class)->dispose(object);
    157153}
     
    208204
    209205    CLUTTER_ACTOR_CLASS(graphics_layer_actor_parent_class)->apply_transform(actor, matrix);
    210 
    211     if (priv->matrix) {
    212         float width = 0, height = 0;
    213         clutter_actor_get_size(actor, &width, &height);
    214         if (width <= 1.0 || height <= 1.0)
    215             return;
    216 
    217         // The pivot of actor is a normalized value, so we need an actual anchor position
    218         // in actor's local coordinate system for translating.
    219         float anchorX = 0, anchorY = 0, anchorZ = 0;
    220         graphicsLayerActorGetAnchorPoint(GRAPHICS_LAYER_ACTOR(actor), &anchorX, &anchorY, &anchorZ);
    221         anchorX *= width;
    222         anchorY *= height;
    223 
    224         // CSS3 tranform-style can be changed on the fly,
    225         // so we have to copy priv->matrix in order to recover z-axis.
    226         CoglMatrix* localMatrix = cogl_matrix_copy(priv->matrix);
    227 
    228         cogl_matrix_translate(matrix, anchorX, anchorY, anchorZ);
    229         cogl_matrix_multiply(matrix, matrix, localMatrix);
    230         cogl_matrix_translate(matrix, -anchorX, -anchorY, -anchorZ);
    231         cogl_matrix_free(localMatrix);
    232     }
    233206}
    234207
     
    381354    // FIXME: Need to invalidate a specific area?
    382355    clutter_content_invalidate(canvas);
    383 }
    384 
    385 void graphicsLayerActorSetTransform(GraphicsLayerActor* layer, const CoglMatrix* matrix)
    386 {
    387     bool needToRedraw = false;
    388 
    389     GraphicsLayerActorPrivate* priv = layer->priv;
    390     if (priv->matrix) {
    391         cogl_matrix_free(priv->matrix);
    392         needToRedraw = true;
    393     }
    394 
    395     if (matrix && !cogl_matrix_is_identity(matrix)) {
    396         priv->matrix = cogl_matrix_copy(matrix);
    397         needToRedraw = true;
    398     } else
    399         priv->matrix = 0;
    400 
    401     if (needToRedraw)
    402         clutter_actor_queue_redraw(CLUTTER_ACTOR(layer));
    403356}
    404357
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h

    r142094 r147145  
    8282void graphicsLayerActorSetSurface(GraphicsLayerActor*, cairo_surface_t*);
    8383void graphicsLayerActorInvalidateRectangle(GraphicsLayerActor*, const WebCore::FloatRect&);
    84 void graphicsLayerActorSetTransform(GraphicsLayerActor*, const CoglMatrix*);
    8584void graphicsLayerActorSetAnchorPoint(GraphicsLayerActor*, float, float, float);
    8685void graphicsLayerActorGetAnchorPoint(GraphicsLayerActor*, float*, float*, float*);
  • trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp

    r147121 r147145  
    679679{
    680680    CoglMatrix matrix = m_transform;
    681     graphicsLayerActorSetTransform(primaryLayer(), &matrix);
     681    clutter_actor_set_transform(CLUTTER_ACTOR(primaryLayer()), &matrix);
    682682}
    683683
  • trunk/Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.cpp

    r146609 r147145  
    612612    }
    613613
    614     // If clutter covers valueFunction type animations, we should release keeping transform matrix.
    615     // Otherwise, the transformation is applied twice unexpectedly. See graphicsLayerActorApplyTransform.
    616     graphicsLayerActorSetTransform(GRAPHICS_LAYER_ACTOR(m_layer.get()), 0);
     614    // FIXME: Work-around the fact that if there is a transform already set the animation fails to start.
     615    // https://bugzilla.gnome.org/show_bug.cgi?id=696804
     616    clutter_actor_set_transform(m_layer.get(), 0);
    617617}
    618618
Note: See TracChangeset for help on using the changeset viewer.