webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 15 60c5402cb945
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
    79         ActivateL();
    79         ActivateL();
    80 		m_windowCreated = true;
    80 		m_windowCreated = true;
    81     } else {
    81     } else {
    82         SetContainerWindowL(*view.brCtl()->CCoeControlParent());
    82         SetContainerWindowL(*view.brCtl()->CCoeControlParent());
    83         m_bitmap = new (ELeave) CFbsBitmap();
    83         m_bitmap = new (ELeave) CFbsBitmap();
    84         m_bitmap->Create(TSize(0,0),WebCore::StaticObjectsContainer::instance()->webSurface()->displayMode());
    84         TDisplayMode mode = m_transparentPlugin ? EColor16MA : WebCore::StaticObjectsContainer::instance()->webSurface()->displayMode();
    85         m_mask = new (ELeave) CFbsBitmap();
    85         m_bitmap->Create(TSize(0,0), mode);
    86         m_mask->Create(TSize(0,0),EGray2);
       
    87     }
    86     }
    88     // Add the focus/foreground observer
    87     // Add the focus/foreground observer
    89     ControlEnv()->AddForegroundObserverL( *this ) ;
    88     ControlEnv()->AddForegroundObserverL( *this ) ;
    90 }
    89 }
    91 
    90 
   100     TRAP_IGNORE( setPluginFocusL( EFalse ) );
    99     TRAP_IGNORE( setPluginFocusL( EFalse ) );
   101 
   100 
   102     // Remove the foreground observer
   101     // Remove the foreground observer
   103     ControlEnv()->RemoveForegroundObserver( *this );
   102     ControlEnv()->RemoveForegroundObserver( *this );
   104     delete m_bitmap;
   103     delete m_bitmap;
   105     delete m_mask;
       
   106     delete m_bitmapDeviceMask;
       
   107     delete m_bitmapContextMask;
       
   108 }
   104 }
   109 
   105 
   110 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   111 // PluginWin::NewL
   107 // PluginWin::NewL
   112 // Two-phased constructor.
   108 // Two-phased constructor.
   143 {
   139 {
   144     TRAPD(ret, windowChangedL());
   140     TRAPD(ret, windowChangedL());
   145     if (ret != KErrNone) {
   141     if (ret != KErrNone) {
   146         delete m_bitmap;
   142         delete m_bitmap;
   147         m_bitmap = NULL;
   143         m_bitmap = NULL;
   148         delete m_mask;
       
   149         m_mask = NULL;
       
   150         delete m_bitmapDeviceMask;
       
   151         m_bitmapDeviceMask = NULL;
       
   152         delete m_bitmapContextMask;
       
   153         m_bitmapContextMask = NULL;
       
   154     }
   144     }
   155     if (m_forceScroll)
   145     if (m_forceScroll)
   156     	m_forceScroll = EFalse;
   146     	m_forceScroll = EFalse;
   157 }
   147 }
   158 
   148 
   191         window.clipRect.right = clipRect.iBr.iX;
   181         window.clipRect.right = clipRect.iBr.iX;
   192 
   182 
   193         if (m_windowedPlugin) {
   183         if (m_windowedPlugin) {
   194              window.window =  (MPluginAdapter*)this;
   184              window.window =  (MPluginAdapter*)this;
   195         } else {
   185         } else {
   196              //m_bitmap->Resize(myRect.Size());
   186              m_bitmap->Resize(rect.Size());
   197              // Resize does not work!
       
   198              // Once the bug is fixed we can call Resize() instead of creating a new bitmap every time.
       
   199              if (!m_bitmap || m_bitmap->SizeInPixels() != myRect.Size()) {
       
   200                  delete m_bitmap;
       
   201                  m_bitmap = NULL;
       
   202                  m_bitmap = new (ELeave) CFbsBitmap();
       
   203                  TDisplayMode mode = m_transparentPlugin ? EColor16MA : WebCore::StaticObjectsContainer::instance()->webSurface()->displayMode();
       
   204                  m_bitmap->Create(myRect.Size(), mode);
       
   205                  delete m_mask;
       
   206                  m_mask = NULL;
       
   207                  if (m_transparentPlugin) {
       
   208                      m_mask = new (ELeave) CFbsBitmap();
       
   209                      m_mask->Create(myRect.Size(), mode);
       
   210                      m_bitmapDeviceMask = CFbsBitmapDevice::NewL( m_mask );
       
   211                      User::LeaveIfError(m_bitmapDeviceMask->CreateContext(m_bitmapContextMask));
       
   212                  }
       
   213              }
       
   214              window.window = (CFbsBitmap*)m_bitmap;
   187              window.window = (CFbsBitmap*)m_bitmap;
   215         }
   188         }
   216 		if (!m_windowedPlugin || m_windowCreated)
   189 		if (!m_windowedPlugin || m_windowCreated)
   217 			m_pluginskin->getNPPluginFucs()->setwindow(m_pluginskin->getNPP(), &window );
   190 			m_pluginskin->getNPPluginFucs()->setwindow(m_pluginskin->getNPP(), &window );
   218 
   191