javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/windowsurfaceimpl_symbian.cpp
changeset 79 2f468c1958d0
parent 48 e0d6e9bd3ca7
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
   316     if(mMainSurface.localSurface == NULL)
   316     if(mMainSurface.localSurface == NULL)
   317     {
   317     {
   318         return false;
   318         return false;
   319     }
   319     }
   320     
   320     
   321     if((mMainSurface.localSurfaceInUse) && 
   321     if((mMainSurface.localSurface->width() == mMainSurface.widget->width()) && 
   322        (mMainSurface.localSurface->width() == mMainSurface.widget->width()) && 
       
   323        (mMainSurface.localSurface->height() == mMainSurface.widget->height()))
   322        (mMainSurface.localSurface->height() == mMainSurface.widget->height()))
   324     {
   323     {
   325         return true;
   324         return true;
   326     }
   325     }
   327     return false;
   326     return false;
   360             mMainSurface.localSurfaceInUse = true;
   359             mMainSurface.localSurfaceInUse = true;
   361             return;
   360             return;
   362         }
   361         }
   363         else 
   362         else 
   364         {
   363         {
   365             // We have valid local surface so just return
   364             // We have valid local surface so make sure its active and return
       
   365             mMainSurface.localSurfaceInUse = true;
   366             return;
   366             return;
   367         }
   367         }
   368     }
   368     }
   369     else 
   369     else 
   370     {
   370     {
   384         }
   384         }
   385     }
   385     }
   386     
   386     
   387     // We got window surface so extract information
   387     // We got window surface so extract information
   388     QPaintDevice* device = surface->paintDevice();
   388     QPaintDevice* device = surface->paintDevice();
       
   389     QPaintEngine* engine = NULL;
       
   390     
       
   391     // If the device is active it means that some painter is attached to the widget,
       
   392     // if not then we attach our own painter to do the job
   389     if(device->paintingActive())
   393     if(device->paintingActive())
   390     {
   394     {
   391         throw GfxException(EGfxErrorIllegalState, "Internal error: Device active when refreshing data");  
   395         engine = device->paintEngine();
   392     }
   396     }
   393     
   397     else
   394     // Attach painter to device in oder to see which type 
   398     {
   395     // of device it is working on
   399         mPainter.begin(device);
   396     mPainter.begin(device);
   400         engine = mPainter.paintEngine();
   397     QPaintEngine* engine = mPainter.paintEngine();
   401     }
   398     
   402     
   399     // determine the surface type based on the engine used
   403     // determine the surface type based on the engine used
   400     // as Qt does not provide exact info of the surface type
   404     // as Qt does not provide exact info of the surface type
   401     switch (engine->type())
   405     switch (engine->type())
   402     {
   406     {
   418             break;
   422             break;
   419         default:
   423         default:
   420             throw GfxException(EGfxErrorIllegalArgument, "Unsupported widget window surface type");
   424             throw GfxException(EGfxErrorIllegalArgument, "Unsupported widget window surface type");
   421     }
   425     }
   422     
   426     
   423     // release painter
   427     // release painter if its active
   424     mPainter.end();
   428     if(mPainter.isActive())
       
   429     {
       
   430         mPainter.end();
       
   431     }
   425     mMainSurface.qSurface = surface;
   432     mMainSurface.qSurface = surface;
   426     mMainSurface.device = device;
   433     mMainSurface.device = device;
   427     mMainSurface.localSurfaceInUse = false;
   434     mMainSurface.localSurfaceInUse = false;
   428 }
   435 }
   429 
   436