NS_IMETHODIMP nsNativeThemeQt::DrawWidgetBackground(nsRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, const nsRect& aRect, const nsRect& aClipRect) { gfxContext* context = aContext->ThebesContext(); nsRefPtr<gfxASurface> surface = context->CurrentSurface(); #ifdef CAIRO_HAS_QT_SURFACE if (surface->GetType() == gfxASurface::SurfaceTypeQPainter) { gfxQPainterSurface* qSurface = (gfxQPainterSurface*) (surface.get()); QPainter *painter = qSurface->GetQPainter(); NS_ASSERTION(painter, "Where'd my QPainter go?"); if (!painter) return NS_ERROR_FAILURE; return DrawWidgetBackground(painter, aContext, aFrame, aWidgetType, aRect, aClipRect); } else #endif if (surface->GetType() == gfxASurface::SurfaceTypeImage) { gfxImageSurface* qSurface = (gfxImageSurface*) (surface.get()); QImage tempQImage(qSurface->Data(), qSurface->Width(), qSurface->Height(), qSurface->Stride(), _qimage_from_gfximage_format(qSurface->Format())); QPainter painter(&tempQImage); return DrawWidgetBackground(&painter, aContext, aFrame, aWidgetType, aRect, aClipRect); } #ifdef MOZ_X11 else if (surface->GetType() == gfxASurface::SurfaceTypeXlib) { gfxXlibSurface* qSurface = (gfxXlibSurface*) (surface.get()); QPixmap pixmap(QPixmap::fromX11Pixmap(qSurface->XDrawable())); QPainter painter(&pixmap); return DrawWidgetBackground(&painter, aContext, aFrame, aWidgetType, aRect, aClipRect); } #endif return NS_ERROR_NOT_IMPLEMENTED; }
void CRClient::handle_rreceive (const boost::system::error_code& error, std::size_t bytes_transferred) { std::cout << "IN" << std::endl; if (!error || error == boost::asio::error::message_size) { switch(recv_rbuffer.data()[ID]) { case CONNECT: connection = true; std::cout << "Connected ! Rendering is about to begin !!" << std::endl; break; case RENDER: std::cout << "Rendered Frame " << (int)(recv_rbuffer.data()[FRAME]) << std::endl; #if 0 { unsigned char* jpegstream = new unsigned char[(int)bytes_transferred-2]; unsigned long jpegsize = (unsigned long)(bytes_transferred - 2); // tjDecompressHeader2(jpeg, jpegstream, jpegsize, &width, &height, &subsamp); // int pitch = width * tjPixelSize[pixelformat]; unsigned char* data = new unsigned char [width*height*tjPixelSize[pixelformat]]; tjDecompress2(jpeg, jpegstream, jpegsize, data, width, pitch, height, pixelformat, flags); //QImage tempQimage(data,width,height,QImage::Format_RGBA8888); QImage tempQImage(data,width,height,QImage::Format_RGBA8888); myFrame->fromImage(tempQImage); //myFrame->fromImage(QImage::QImage(data,width,height,QImage::Format_RGBA8888)); delete [] jpegstream; } #endif qDebug() << "Emiting"; // emit updateFrameBuffer_signal(myFrame); qDebug() << "Emitted"; break; case EXIT: std::cout << "Exiting " << std::endl; return; default: std::cout << "Failed" << std::endl; break; } qDebug() << "Listen Again"; //rlisten (); } rlisten (); }