~cairo-dock-team/ubuntu/quantal/cairo-dock-plug-ins/3.0.2

« back to all changes in this revision

Viewing changes to dock-rendering/src/rendering-rainbow.c

Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
extern double my_fRainbowColor[4];
37
37
extern double my_fRainbowLineColor[4];
38
38
 
39
 
void cd_rendering_calculate_max_dock_size_rainbow (CairoDock *pDock)
 
39
static double *pCosSinTab = NULL;
 
40
static GLfloat *pVertexTab = NULL;
 
41
static GLfloat* pColorTab = NULL;
 
42
 
 
43
static void cd_rendering_calculate_max_dock_size_rainbow (CairoDock *pDock)
40
44
{
41
45
        pDock->fMagnitudeMax = my_fRainbowMagnitude;
42
46
        pDock->pFirstDrawnElement = cairo_dock_calculate_icons_positions_at_rest_linear (pDock->icons, pDock->fFlatDockWidth, pDock->iScrollOffset);
61
65
}
62
66
 
63
67
 
64
 
void cd_rendering_render_rainbow (cairo_t *pCairoContext, CairoDock *pDock)
 
68
static void cd_rendering_render_rainbow (cairo_t *pCairoContext, CairoDock *pDock)
65
69
{
66
70
        //g_print ("pDock->fFoldingFactor : %.2f\n", pDock->fFoldingFactor);
67
71
        double fMaxScale =  1. + my_fRainbowMagnitude * g_fAmplitude;
371
375
        return iPointedRow;
372
376
}
373
377
 
374
 
Icon *cd_rendering_calculate_icons_rainbow (CairoDock *pDock)
 
378
static Icon *cd_rendering_calculate_icons_rainbow (CairoDock *pDock)
375
379
{
376
380
        if (pDock->icons == NULL)
377
381
                return NULL;
414
418
        Icon *pFirstIcon = pFirstDrawnElement->data;
415
419
        
416
420
        int iNbRow = -1, iNbIconsOnRow = 0, iNbInsertedIcons = 0;
417
 
        double fCurrentRadius=0, fNormalRadius=0, fCurrentTheta, fThetaStart, fDeltaTheta, fCurrentScale;
 
421
        double fCurrentRadius=0, fNormalRadius=0, fCurrentTheta, fThetaStart=0, fDeltaTheta=0, fCurrentScale=1;
418
422
        do
419
423
        {
420
424
                icon = ic->data;
538
542
        return pTabValues;
539
543
}
540
544
 
541
 
static double *pCosSinTab = NULL;
542
 
static GLfloat *pVertexTab = NULL;
543
 
static GLfloat* pColorTab = NULL;
544
 
void cd_rendering_reload_rainbow_buffers (void)
545
 
{
546
 
        g_free (pColorTab);
547
 
        pColorTab = NULL;
548
 
        g_free (pCosSinTab);
549
 
        pCosSinTab = NULL;
550
 
}
551
 
 
552
 
void cd_rendering_render_rainbow_opengl (CairoDock *pDock)
 
545
static void cd_rendering_render_rainbow_opengl (CairoDock *pDock)
553
546
{
554
547
        static double fDelta = 1.;
555
548
        if (pCosSinTab == NULL)
622
615
                                _generate_sector_path (my_fRainbowConeOffset,
623
616
                                        fRadius + .5 * pDock->iMaxIconHeight * fMaxScale,
624
617
                                        fRadius - my_iSpaceBetweenRows/2,
625
 
                                        
626
618
                                        fDelta/180.*G_PI, pCosSinTab, pVertexTab);
627
619
                                
628
620
                                glVertexPointer(3, GL_FLOAT, 0, pVertexTab);
681
673
                my_fRainbowLineColor[0], my_fRainbowLineColor[1], my_fRainbowLineColor[2], 0.};
682
674
                glEnableClientState(GL_COLOR_ARRAY);
683
675
                glColorPointer(4, GL_FLOAT, 0, color);
684
 
                glVertexPointer(3, GL_FLOAT, 0, pVertexTab);
 
676
                glVertexPointer(2, GL_FLOAT, 0, pVertexTab);
685
677
                
686
 
                pVertexTab[3*0+0] = - (fRadius + .5 * pDock->iMaxIconHeight * fMaxScale + my_iSpaceBetweenRows/2) * pCosSinTab[2*0];
687
 
                pVertexTab[3*0+1] = (fRadius + .5 * pDock->iMaxIconHeight * fMaxScale + my_iSpaceBetweenRows/2) * pCosSinTab[2*0+1];
688
 
                pVertexTab[3*1+0] = - fRadius * cos (my_fRainbowConeOffset);
689
 
                pVertexTab[3*1+1] = fRadius * sin (my_fRainbowConeOffset);
690
 
                pVertexTab[3*2+0] = 0.;
691
 
                pVertexTab[3*2+1] = 0.;
692
 
                pVertexTab[3*3+0] = - pVertexTab[3*1+0];
693
 
                pVertexTab[3*3+1] = pVertexTab[3*1+1];
694
 
                pVertexTab[3*4+0] = - pVertexTab[3*0+0];
695
 
                pVertexTab[3*4+1] = pVertexTab[3*0+1];
 
678
                pVertexTab[2*0+0] = - (fRadius + .5 * pDock->iMaxIconHeight * fMaxScale + my_iSpaceBetweenRows/2) * pCosSinTab[2*0];
 
679
                pVertexTab[2*0+1] = (fRadius + .5 * pDock->iMaxIconHeight * fMaxScale + my_iSpaceBetweenRows/2) * pCosSinTab[2*0+1];
 
680
                pVertexTab[2*1+0] = - fRadius * cos (my_fRainbowConeOffset);
 
681
                pVertexTab[2*1+1] = fRadius * sin (my_fRainbowConeOffset);
 
682
                pVertexTab[2*2+0] = 0.;
 
683
                pVertexTab[2*2+1] = 0.;
 
684
                pVertexTab[2*3+0] = - pVertexTab[2*1+0];
 
685
                pVertexTab[2*3+1] = pVertexTab[2*1+1];
 
686
                pVertexTab[2*4+0] = - pVertexTab[2*0+0];
 
687
                pVertexTab[2*4+1] = pVertexTab[2*0+1];
696
688
                
697
689
                cairo_dock_draw_current_path_opengl (myBackground.iDockLineWidth, my_fRainbowLineColor, 5);
698
690
                
723
715
}
724
716
 
725
717
 
 
718
 
 
719
void cd_rendering_reload_rainbow_buffers (void)
 
720
{
 
721
        g_free (pColorTab);
 
722
        pColorTab = NULL;
 
723
        g_free (pCosSinTab);
 
724
        pCosSinTab = NULL;
 
725
}
 
726
 
 
727
 
726
728
void cd_rendering_register_rainbow_renderer (const gchar *cRendererName)
727
729
{
728
730
        CairoDockRenderer *pRenderer = g_new0 (CairoDockRenderer, 1);