~ubuntu-branches/ubuntu/trusty/compiz/trusty

« back to all changes in this revision

Viewing changes to plugins/animation/src/grid.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-08-22 06:58:07 UTC
  • mto: This revision was merged to the branch mainline in revision 3352.
  • Revision ID: package-import@ubuntu.com-20130822065807-17nlzez0d30y09so
Tags: upstream-0.9.10+13.10.20130822
ImportĀ upstreamĀ versionĀ 0.9.10+13.10.20130822

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
            height - decorTopHeight - decorBottomHeight;
102
102
 
103
103
        //Top
104
 
        for (gridX = 0; gridX < gridWidth; gridX++)
 
104
        for (gridX = 0; gridX < gridWidth; ++gridX)
105
105
        {
106
106
            Point gridPos ((float)gridX / nGridCellsX, 0);
107
107
 
109
109
        }
110
110
 
111
111
        // Window contents
112
 
        for (gridY = 1; gridY < gridHeight - 1; gridY++)
 
112
        for (gridY = 1; gridY < gridHeight - 1; ++gridY)
113
113
        {
114
114
            float inWinY =
115
115
                (gridY - 1) * winContentsHeight / nGridCellsY +
116
116
                decorTopHeight;
117
117
            float gridPosY = inWinY / height;
118
118
 
119
 
            for (gridX = 0; gridX < gridWidth; gridX++)
 
119
            for (gridX = 0; gridX < gridWidth; ++gridX)
120
120
            {
121
121
                Point gridPos ((float)gridX / nGridCellsX, gridPosY);
122
122
                mObjects[gridY * gridWidth + gridX].setGridPosition (gridPos);
124
124
        }
125
125
 
126
126
        // Bottom (gridY is gridHeight-1 now)
127
 
        for (gridX = 0; gridX < gridWidth; gridX++)
 
127
        for (gridX = 0; gridX < gridWidth; ++gridX)
128
128
        {
129
129
            Point gridPos ((float)gridX / nGridCellsX, 1);
130
130
            mObjects[gridY * gridWidth + gridX].setGridPosition (gridPos);
137
137
        // number of grid cells in y direction
138
138
        nGridCellsY = gridHeight - 1;
139
139
 
140
 
        for (gridY = 0; gridY < gridHeight; gridY++)
 
140
        for (gridY = 0; gridY < gridHeight; ++gridY)
141
141
        {
142
 
            for (gridX = 0; gridX < gridWidth; gridX++)
 
142
            for (gridX = 0; gridX < gridWidth; ++gridX)
143
143
            {
144
144
                // TODO Optimize
145
145
                Point gridPos ((float)gridX / nGridCellsX,
146
146
                               (float)gridY / nGridCellsY);
147
147
                mObjects[objIndex].setGridPosition (gridPos);
148
 
                objIndex++;
 
148
                ++objIndex;
149
149
            }
150
150
        }
151
151
    }
156
156
                           float ty)
157
157
{
158
158
    GridObject *object = mObjects;
159
 
    for (unsigned int i = 0; i < mNumObjects; i++, object++)
 
159
    for (unsigned int i = 0; i < mNumObjects; ++i, ++object)
160
160
    {
161
161
        object->mPosition.add (Point3d (tx, ty, 0));
162
162
    }
166
166
GridAnim::updateBB (CompOutput &output)
167
167
{
168
168
    GridModel::GridObject *object = mModel->mObjects;
169
 
    for (unsigned int i = 0; i < mModel->mNumObjects; i++, object++)
 
169
    for (unsigned int i = 0; i < mModel->mNumObjects; ++i, ++object)
170
170
    {
171
171
        mAWindow->expandBBWithPoint (object->position ().x () + 0.5,
172
172
                                     object->position ().y () + 0.5);
321
321
            int topiy = (int)(topiyFloat + 1e-4);
322
322
 
323
323
            if (topiy == mGridHeight - 1)
324
 
                topiy--;
 
324
                --topiy;
 
325
 
325
326
            int bottomiy = topiy + 1;
326
327
            float iny = topiyFloat - topiy;
327
328
            float inyRest = 1 - iny;
339
340
                int leftix = (int)(leftixFloat + 1e-4);
340
341
 
341
342
                if (leftix == mGridWidth - 1)
342
 
                    leftix--;
 
343
                    --leftix;
 
344
 
343
345
                int rightix = leftix + 1;
344
346
 
345
347
                // GridModel::GridObjects that are at top, bottom, left, right corners of quad
441
443
    {
442
444
        GridModel::GridObject *object = mModel->objects ();
443
445
        unsigned int n = mModel->numObjects ();
444
 
        for (unsigned int i = 0; i < n; i++, object++)
 
446
        for (unsigned int i = 0; i < n; ++i, ++object)
445
447
        {
446
448
            GLVector coords (object->mPosition.x (),
447
449
                             object->mPosition.y (), 0, 1);