+/**
+ * Determine if we can do an optimized glCopyPixels.
+ */
+static GLboolean
+can_do_CopyPixels(GLcontext *ctx, GLenum type)
+{
+ if (type == GL_COLOR &&
+ ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */
+ ctx->Pixel.ZoomX == 1.0 && /* no zooming */
+ ctx->Pixel.ZoomY == 1.0 &&
+ ctx->Color.DrawBuffer[0] == GL_FRONT && /* copy to front buf */
+ ctx->Pixel.ReadBuffer == GL_FRONT && /* copy from front buf */
+ ctx->ReadBuffer->_ColorReadBuffer &&
+ ctx->DrawBuffer->_ColorDrawBuffers[0]) {
+ const SWcontext *swrast = SWRAST_CONTEXT( ctx );
+
+ if (swrast->NewState)
+ _swrast_validate_derived( ctx );
+
+ if ((swrast->_RasterMask & ~CLIP_BIT) == 0x0 &&
+ ctx->ReadBuffer &&
+ ctx->ReadBuffer->_ColorReadBuffer &&
+ ctx->DrawBuffer &&
+ ctx->DrawBuffer->_ColorDrawBuffers[0]) {
+ struct xmesa_renderbuffer *srcXrb
+ = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped);
+ struct xmesa_renderbuffer *dstXrb
+ = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
+ if (srcXrb->pixmap && dstXrb->pixmap) {
+ return GL_TRUE;
+ }
+ }
+ }
+ return GL_FALSE;
+}
+