view Android/examples/native_test/native_test.cpp @ 1160:1a699dc00fa3

Fix the issue of not removing node in old scene when switching scenes. - When a timeline is playing and crossing two scenes (tween block), nodes, for the old scene, in duplicate group must be removed. But, it is not. - It is fixed by checking if nodes, in the duplicate group, are also in the key frame next to the new scene. All nodes that is not in next key frame are remove.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 28 Dec 2010 13:35:34 +0800
parents 3a7bce43ec6e
children
line wrap: on
line source

#include <SkCanvas.h>
#include <SkBitmap.h>

extern "C" {
#include <mb.h>
};

void native_test(void) {
    mbe_t *mbe1, *mbe2;
    SkBitmap *bmap1, *bmap2;
    redraw_man_t _rdman;
    redraw_man_t *rdman = &_rdman;
    coord_t *root;
    shape_t *shape;
    paint_t *paint;

    bmap1 = new SkBitmap();
    bmap1->setConfig(SkBitmap::kARGB_8888_Config, 300, 300);
    mbe1 = mbe_create((mbe_surface_t *)bmap1);
    bmap2 = new SkBitmap();
    bmap2->setConfig(SkBitmap::kARGB_8888_Config, 300, 300);
    mbe2 = mbe_create((mbe_surface_t *)bmap2);

    redraw_man_init(rdman, mbe1, mbe2);
    root = rdman_get_root(rdman);
    shape = rdman_shape_path_new(rdman, "M 100 100 L 100 150 L 150 150 z");
    paint = rdman_paint_color_new(rdman, 1, 0, 0, 1);
    rdman_paint_stroke(rdman, paint, shape);
    rdman_add_shape(rdman, shape, root);

    rdman_shape_changed(rdman, shape);
    rdman_paint_changed(rdman, paint);

    rdman_redraw_all(rdman);

    rdman_paint_free(rdman, paint);
    rdman_shape_free(rdman, shape);
    redraw_man_destroy(rdman);
}

int main(int argc, const char *argv[]) {
    native_test();
    return 0;
}