annotate Android/examples/native_test/native_test.cpp @ 1268:cd848c2ec29f

Remove unused code. - Keep code base as clean as possible before commiting it. - Keep clean is a rule that should be followed anytime/anywhere. - Since we have VCS, don't leave anything that is no more used for the regret at later.
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 12 Jan 2011 20:52:34 +0800
parents 3a7bce43ec6e
children
rev   line source
518
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #include <SkCanvas.h>
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #include <SkBitmap.h>
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 extern "C" {
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #include <mb.h>
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 };
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 void native_test(void) {
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 mbe_t *mbe1, *mbe2;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 SkBitmap *bmap1, *bmap2;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 redraw_man_t _rdman;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 redraw_man_t *rdman = &_rdman;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 coord_t *root;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 shape_t *shape;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 paint_t *paint;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 bmap1 = new SkBitmap();
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 bmap1->setConfig(SkBitmap::kARGB_8888_Config, 300, 300);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 mbe1 = mbe_create((mbe_surface_t *)bmap1);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 bmap2 = new SkBitmap();
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 bmap2->setConfig(SkBitmap::kARGB_8888_Config, 300, 300);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 mbe2 = mbe_create((mbe_surface_t *)bmap2);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 redraw_man_init(rdman, mbe1, mbe2);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 root = rdman_get_root(rdman);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 shape = rdman_shape_path_new(rdman, "M 100 100 L 100 150 L 150 150 z");
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 paint = rdman_paint_color_new(rdman, 1, 0, 0, 1);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 rdman_paint_stroke(rdman, paint, shape);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 rdman_add_shape(rdman, shape, root);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 rdman_shape_changed(rdman, shape);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 rdman_paint_changed(rdman, paint);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 rdman_redraw_all(rdman);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 rdman_paint_free(rdman, paint);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 rdman_shape_free(rdman, shape);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 redraw_man_destroy(rdman);
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 }
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 int main(int argc, const char *argv[]) {
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 native_test();
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 return 0;
3a7bce43ec6e Android native code with MB
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 }