artifacts when applying DeformEffect to Actor in Gjs



I was testing some gjs/clutter stuff to see what I could do, and I came across some odd behavior I can't figure out or find any mention in google. 

I run the following code in gjs-console on ubuntu 14.04 running Gnome Shell.  When I subclass an actor and override paint, even if it just calls the parent (This calls the baseclass, right?), than the object is drawn correctly with the DeformEffect.  If I don't override paint, or I use a standard actor, than there is strange clipping/artifacts around the edges of it.

I would like ot figure out whats causing this because I would like to apply a DeformEffect to existing actors.  Anyone know what's going on?

Thanks,
B


    const Lang = imports.lang;
     
    const Cogl = imports.gi.Cogl;
    const Clutter = imports.gi.Clutter;
     
    const MyClutterActor = new Lang.Class({
        Name: 'MyClutterActor',
        Extends: Clutter.Actor,

     
        vfunc_paint: function() {
            this.parent();
        }
    });
     
    const MyClutterEffect = new Lang.Class({
        Name: 'MyClutterEffect',
        Extends: Clutter.DeformEffect,
     
        vfunc_deform_vertex: function(width, height, vertex) {
            vertex.x += Math.random() * 20 - 10;
            vertex.y += Math.random() * 20 - 10;
        }
    });
     
     Clutter.init(null);
     
    let actor = new MyClutterActor(); // draws correctly
    //let actor = new Clutter.Actor(); // artifacts
    actor.set_size(100,100);
    actor.set_background_color(new Clutter.Color({red:255,green:0,blue:0,alpha:255}));

    actor.set_reactive(true);
    actor.connect('button-press-event', function(){
        log('click');
        actor.set_easing_duration(0);
        actor.set_position(0,0);
        actor.set_easing_duration(2000);
        actor.set_easing_mode(Clutter.AnimationMode.EASE_IN_OUT_CUBIC);
        actor.set_position(200,200);
    });

    actor.add_effect(new MyClutterEffect());

    let stage = Clutter.Stage.get_default();
    stage.add_actor(actor);
    stage.show_all();
     
    Clutter.main();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]