~ubuntu-branches/ubuntu/lucid/compiz-fusion-plugins-extra/lucid

« back to all changes in this revision

Viewing changes to src/bench/bench.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2007-12-05 22:48:25 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20071205224825-yhfs0zm2evj7ca3x
Tags: 0.6.99+git20071127-0ubuntu1
new git HEAD snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 *
21
21
 **/
22
22
 
23
 
#include <stdlib.h>
24
 
#include <string.h>
25
 
#include <stdio.h>
26
 
#include <math.h>
27
 
#include <X11/Xatom.h>
28
 
#include <X11/extensions/Xrender.h>
29
 
#include <compiz.h>
 
23
#include <compiz-core.h>
30
24
 
31
25
#include "bench_tex.h"
32
26
#include "bench_options.h"
33
27
 
34
28
#define GET_BENCH_DISPLAY(d)                                  \
35
 
    ((BenchDisplay *) (d)->privates[displayPrivateIndex].ptr)
 
29
    ((BenchDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
36
30
 
37
31
#define BENCH_DISPLAY(d)                      \
38
32
    BenchDisplay *bd = GET_BENCH_DISPLAY (d)
39
33
 
40
34
#define GET_BENCH_SCREEN(s, bd)                                   \
41
 
    ((BenchScreen *) (s)->privates[(bd)->screenPrivateIndex].ptr)
 
35
    ((BenchScreen *) (s)->base.privates[(bd)->screenPrivateIndex].ptr)
42
36
 
43
37
#define BENCH_SCREEN(s)                                                      \
44
38
    BenchScreen *bs = GET_BENCH_SCREEN (s, GET_BENCH_DISPLAY (s->display))
365
359
 
366
360
    BenchScreen *bs = (BenchScreen *) calloc (1, sizeof (BenchScreen) );
367
361
 
368
 
    s->privates[bd->screenPrivateIndex].ptr = bs;
 
362
    s->base.privates[bd->screenPrivateIndex].ptr = bs;
369
363
 
370
364
    WRAP (bs, s, paintOutput, benchPaintOutput);
371
365
    WRAP (bs, s, preparePaintScreen, benchPreparePaintScreen);
515
509
                  CompDisplay *d)
516
510
{
517
511
    //Generate a bench display
518
 
    BenchDisplay *bd = (BenchDisplay *) malloc (sizeof (BenchDisplay) );
519
 
 
 
512
    BenchDisplay *bd;
 
513
 
 
514
    if (!checkPluginABI ("core", CORE_ABIVERSION))
 
515
        return FALSE;
 
516
 
 
517
    bd = (BenchDisplay *) malloc (sizeof (BenchDisplay));
 
518
    
 
519
    if (!bd)
 
520
        return FALSE;
 
521
    
520
522
    //Allocate a private index
521
523
    bd->screenPrivateIndex = allocateScreenPrivateIndex (d);
522
524
    //Check if its valid
528
530
        return FALSE;
529
531
    }
530
532
 
531
 
    benchSetInitiateInitiate (d, benchInitiate);
 
533
    benchSetInitiateKeyInitiate (d, benchInitiate);
532
534
 
533
535
    bd->active = FALSE;
534
536
    //Record the display
535
 
    d->privates[displayPrivateIndex].ptr = bd;
 
537
    d->base.privates[displayPrivateIndex].ptr = bd;
536
538
    return TRUE;
537
539
}
538
540
 
567
569
        freeDisplayPrivateIndex (displayPrivateIndex);
568
570
}
569
571
 
570
 
static int
571
 
benchGetVersion (CompPlugin *plugin,
572
 
                 int        version)
573
 
{
574
 
    return ABIVERSION;
575
 
}
576
 
 
 
572
static CompBool
 
573
benchInitObject (CompPlugin *p,
 
574
                 CompObject *o)
 
575
{
 
576
    static InitPluginObjectProc dispTab[] = {
 
577
        (InitPluginObjectProc) 0, /* InitCore */
 
578
        (InitPluginObjectProc) benchInitDisplay,
 
579
        (InitPluginObjectProc) benchInitScreen
 
580
    };
 
581
 
 
582
    RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o));
 
583
}
 
584
 
 
585
static void
 
586
benchFiniObject (CompPlugin *p,
 
587
                 CompObject *o)
 
588
{
 
589
    static FiniPluginObjectProc dispTab[] = {
 
590
        (FiniPluginObjectProc) 0, /* FiniCore */
 
591
        (FiniPluginObjectProc) benchFiniDisplay,
 
592
        (FiniPluginObjectProc) benchFiniScreen
 
593
    };
 
594
 
 
595
    DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o));
 
596
}
577
597
 
578
598
CompPluginVTable benchVTable = {
579
 
 
580
599
    "bench",
581
 
    benchGetVersion,
582
600
    0,
583
601
    benchInit,
584
602
    benchFini,
585
 
    benchInitDisplay,
586
 
    benchFiniDisplay,
587
 
    benchInitScreen,
588
 
    benchFiniScreen,
589
 
    0,
590
 
    0,
591
 
    0,
592
 
    0,
593
 
    0,
594
 
    0,
 
603
    benchInitObject,
 
604
    benchFiniObject,
 
605
    0,
 
606
    0
595
607
};
596
608
 
597
609
CompPluginVTable *