~amaranth/compiz-core/gles

« back to all changes in this revision

Viewing changes to plugins/screenshot/src/screenshot.cpp

  • Committer: Travis Watkins
  • Date: 2011-08-10 16:56:45 UTC
  • mfrom: (2778.1.37)
  • Revision ID: travis.watkins@linaro.org-20110810165645-y5tmvfyex36bukbo
merge in gles git branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
                           CompOutput                *output,
239
239
                           unsigned int               mask)
240
240
{
 
241
    GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
 
242
    GLMatrix        transform (matrix);
 
243
    GLfloat         vertexData[12];
 
244
    GLushort        colorData[4];
241
245
    bool status;
242
246
 
243
247
    status = gScreen->glPaintOutput (attrib, matrix, region, output, mask);
253
257
 
254
258
        if (mGrabIndex)
255
259
        {
256
 
            glPushMatrix ();
257
 
 
258
 
            glTranslatef (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
259
 
            glScalef (1.0f  / output->width (),
260
 
                      -1.0f / output->height (),
261
 
                      1.0f);
262
 
            glTranslatef (-output->region ()->extents.x1,
263
 
                          -output->region ()->extents.y2,
264
 
                          0.0f);
265
 
 
266
 
            glDisableClientState (GL_TEXTURE_COORD_ARRAY);
267
 
            glEnable (GL_BLEND);
268
 
            glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
269
 
            glRecti (x1, y2, x2, y1);
270
 
            glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
271
 
            glBegin (GL_LINE_LOOP);
272
 
            glVertex2i (x1, y1);
273
 
            glVertex2i (x2, y1);
274
 
            glVertex2i (x2, y2);
275
 
            glVertex2i (x1, y2);
276
 
            glEnd ();
277
 
            glColor4usv (defaultColor);
278
 
            glDisable (GL_BLEND);
279
 
            glEnableClientState (GL_TEXTURE_COORD_ARRAY);
280
 
            glPopMatrix ();
 
260
            vertexData[0]  = x1;
 
261
            vertexData[1]  = y1;
 
262
            vertexData[2]  = 0.0f;
 
263
            vertexData[3]  = x1;
 
264
            vertexData[4]  = y2;
 
265
            vertexData[5]  = 0.0f;
 
266
            vertexData[6]  = x2;
 
267
            vertexData[7]  = y1;
 
268
            vertexData[8]  = 0.0f;
 
269
            vertexData[9]  = x2;
 
270
            vertexData[10] = y2;
 
271
            vertexData[11] = 0.0f;
 
272
 
 
273
            colorData[0] = 0x2f;
 
274
            colorData[1] = 0x2f;
 
275
            colorData[2] = 0x4f;
 
276
            colorData[3] = 0x4f;
 
277
 
 
278
            transform.translate (-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
 
279
            transform.scale (1.0f / output->width (),
 
280
                             -1.0f / output->height (),
 
281
                             1.0f);
 
282
            transform.translate (-output->region ()->extents.x1,
 
283
                                 -output->region ()->extents.y2,
 
284
                                 0.0f);
 
285
 
 
286
            streamingBuffer->begin (GL_TRIANGLE_STRIP);
 
287
 
 
288
            streamingBuffer->addColors (1, colorData);
 
289
            streamingBuffer->addVertices (4, vertexData);
 
290
 
 
291
            streamingBuffer->end ();
 
292
            streamingBuffer->render (transform);
 
293
 
 
294
            streamingBuffer->begin (GL_LINE_LOOP);
 
295
 
 
296
            vertexData[6]  = x2;
 
297
            vertexData[7]  = y2;
 
298
            vertexData[9]  = x2;
 
299
            vertexData[10] = y1;
 
300
            colorData [3]  = 0x9f;
 
301
            streamingBuffer->addColors (1, colorData);
 
302
            streamingBuffer->addVertices (4, vertexData);
 
303
 
 
304
            streamingBuffer->end ();
 
305
            streamingBuffer->render (transform);
281
306
        }
282
307
    }
283
308