예제 #1
0
bool PoolTeeBox::Load(File* pf)
{
  // Get vertex.
  if (!pf->GetFloat(&m_teeVertex.x)  ||
      !pf->GetFloat(&m_teeVertex.y)  ||
      !pf->GetFloat(&m_teeVertex.z))
  {
    pf->ReportError("Failed to load tee box vertex.");
    return false;
  }

  m_bs.SetCentre(m_teeVertex);
  m_bs.SetRadius(TEE_BOX_DECAL_SIZE); 

  SetShadowSize(TEE_BOX_DECAL_SIZE); // TODO TEMP TEST
  CreateShadow();

  Orientation o;
  o.SetVertex(m_teeVertex);
  SetOrientation(o);

  TEE_BOX_DECAL_SIZE = Engine::Instance()->GetConfigFloat("golf_tee_size");

  return true;
}
예제 #2
0
TRI_shadow_t* TRI_StoreShadowData (TRI_shadow_store_t* const store,
                                   const void* const data) {
  TRI_shadow_t* shadow;

  assert(store);

  shadow = CreateShadow(data);
  if (shadow) {
    LOG_TRACE("storing shadow %p with data ptr %p and id %llu",
            shadow,
            shadow->_data,
            (unsigned long long) shadow->_id);

    TRI_LockMutex(&store->_lock);
    if (TRI_InsertKeyAssociativePointer(&store->_ids, &shadow->_id, shadow, false)) {
      // duplicate entry
      LOG_WARNING("storing shadow failed");

      TRI_UnlockMutex(&store->_lock);
      TRI_Free(TRI_UNKNOWN_MEM_ZONE, shadow);
      return NULL;
    }

    TRI_InsertKeyAssociativePointer(&store->_pointers, data, shadow, false);

    TRI_UnlockMutex(&store->_lock);
  }

  // might be NULL in case of OOM
  return shadow;
}
예제 #3
0
VisibleGameObject::VisibleGameObject()
{
  m_oldx = -1000.0f; // So we initially populate the HeightServer.
  m_oldy = -1000.0f;
  m_oldz = -1000.0f;
  // Default: should be overwritten on Load.
  m_shadowSize = 0.5;

  // Do this again in Load() for special shadows
  CreateShadow(); 
}
예제 #4
0
HRESULT CShadeWnd::UpdateUI()
{
	if(m_pMask == NULL)
	{
		return __super::UpdateUI();
	}
	if(m_pRootFrame == NULL)
	{
		return E_FAIL;
	}

	HDC hdcScreen = ::GetDC(NULL);

	CRect rcWindow;
	GetWindowRect(&rcWindow);

	CRect rcFrame(0,0,rcWindow.Width(),rcWindow.Height());
	HDC hdcMem = ::CreateCompatibleDC(hdcScreen);
	HBITMAP hBmp = ::CreateCompatibleBitmap( hdcScreen, rcWindow.Width(),rcWindow.Height() );
	HGDIOBJ hBmpOld = ( HBITMAP )::SelectObject( hdcMem, hBmp );

	
	if ( hdcMem && hBmp)
	{
		PaintBkg(hdcMem);
		Util::BroadcastPaint(m_pRootFrame,hdcMem,m_pRootFrame->GetPaintRect(),rcFrame);

		CreateShadow(hdcMem,CSize(rcWindow.Width(),rcWindow.Height()),m_rcMaskMargin);
		
		BLENDFUNCTION blend;
		blend.BlendOp               = AC_SRC_OVER;
		blend.BlendFlags            = 0;
		blend.SourceConstantAlpha   = 255;
		blend.AlphaFormat           = AC_SRC_ALPHA;


		::UpdateLayeredWindow(m_hWnd, hdcScreen, 
			&rcWindow.TopLeft(),&rcWindow.Size(),
			hdcMem, &CPoint(0,0), RGB(0,0,0), &blend, ULW_ALPHA );


		::SelectObject( hdcMem, hBmpOld );
		::DeleteObject( hBmp );
		::DeleteDC( hdcMem );


		::ReleaseDC(NULL,hdcScreen);
	}


	return S_OK;
}
예제 #5
0
void psShadowManager::RecreateAllShadows()
{
    if (!shadowsEnabled)
        return;

    const csPDelArray<GEMClientObject>& entities = psengine->GetCelClient()->GetEntities();
    size_t len = entities.GetSize();
    for (size_t a=0; a<len; ++a)
    {
        if(entities[a]->HasShadow())
        {
            CreateShadow(entities[a]);
        }
    }
}
예제 #6
0
void SetEnemy( D3DXVECTOR3 pos, float rotY, ENEMY_TYPE type)
{
	for(int nCntEnemy = 0; nCntEnemy < MAX_ENEMY; nCntEnemy++)
	{
		if( !g_enemy[nCntEnemy].bUse)
		{
			g_enemy[nCntEnemy].pos = pos;
			g_enemy[nCntEnemy].rotTarget.y = rotY;
			g_enemy[nCntEnemy].rot.y = rotY;
			g_enemy[nCntEnemy].type = type;
			g_enemy[nCntEnemy].bUse = true;
			g_enemy[nCntEnemy].nIdxShadow = CreateShadow( g_enemy[nCntEnemy].pos, 50.0f, 50.0f);
			break;
		}
	}
}
예제 #7
0
void
initialize(ID3D11Device* device)
{
  createOpaque(device);
  createAlphaBlend(device);
  createSubstract(device);
  CreateMultiply(device);
  CreateMakrMirror(device);
  CreateRenderReflection(device);
  CreateShadow(device);
  createDepthLessEqual(device);
  CreateCullNone(device);
  CreateCullClockwise(device);
  CreateCullCounterClockwise(device);
  createWireframe(device);
}
예제 #8
0
IShadowPtr IShadow::CreateShadowFromStream(SYSTEM::IArchive &ar)
{
	unsigned long lPos = ar.GetCurrentPos();

	int type;
	ar & type;

	ar.GetCurrentPos() = lPos;

	IShadowPtr pShadow = CreateShadow((Shadow_Type)type);

	if (pShadow != NULL)
		pShadow->serialization(ar);

	return pShadow;

}
bool C_PhysPropClientside::Initialize()
{
	if ( InitializeAsClientEntity( STRING(GetModelName()), RENDER_GROUP_OPAQUE_ENTITY ) == false )
	{
		return false;
	}

	const model_t *mod = GetModel();
	if ( mod )
	{
		Vector mins, maxs;
		modelinfo->GetModelBounds( mod, mins, maxs );
		SetCollisionBounds( mins, maxs );
	}

	solid_t tmpSolid;

	// Create the object in the physics system

	if ( !PhysModelParseSolid( tmpSolid, this, GetModelIndex() ) )
	{
		DevMsg("C_PhysPropClientside::Initialize: PhysModelParseSolid failed for entity %i.\n", GetModelIndex() );
		return false;
	}
	else
	{
		m_pPhysicsObject = VPhysicsInitNormal( SOLID_VPHYSICS, 0, m_spawnflags & SF_PHYSPROP_START_ASLEEP, &tmpSolid );
	
		if ( !m_pPhysicsObject )
		{
			// failed to create a physics object
		DevMsg(" C_PhysPropClientside::Initialize: VPhysicsInitNormal() failed for %s.\n", STRING(GetModelName()) );
			return false;
		}
	}

	// We want touch calls when we hit the world
	unsigned int flags = VPhysicsGetObject()->GetCallbackFlags();
	VPhysicsGetObject()->SetCallbackFlags( flags | CALLBACK_GLOBAL_TOUCH_STATIC );

	if ( m_spawnflags & SF_PHYSPROP_MOTIONDISABLED )
	{
		m_pPhysicsObject->EnableMotion( false );
	}
		
	Spawn(); // loads breakable & prop data

	if ( m_iPhysicsMode == PHYSICS_MULTIPLAYER_AUTODETECT )
	{
		m_iPhysicsMode = GetAutoMultiplayerPhysicsMode( 
			CollisionProp()->OBBSize(), m_pPhysicsObject->GetMass() );
	}

	if 	( m_spawnflags & SF_PHYSPROP_FORCE_SERVER_SIDE )
	{
		// forced to be server-side by map maker
		return false;
	}
		

	
	if ( m_iPhysicsMode != PHYSICS_MULTIPLAYER_CLIENTSIDE )
	{
		// spawn only clientside entities
		return false;
	}
	else 
	{
		if ( engine->IsInEditMode() )
		{
			// don't spawn in map edit mode
			return false;
		}
	}

	if ( m_fadeMinDist < 0 )
	{
		// start fading out at 75% of r_propsmaxdist
		m_fadeMaxDist = r_propsmaxdist.GetFloat();
		m_fadeMinDist = r_propsmaxdist.GetFloat() * 0.75f;
	}

	// player can push it away
	SetCollisionGroup( COLLISION_GROUP_PUSHAWAY );

	UpdatePartitionListEntry();

	CollisionProp()->UpdatePartition();

	SetBlocksLOS( false ); // this should be a small object

	// Set up shadows; do it here so that objects can change shadowcasting state
	CreateShadow();

	UpdateVisibility();

	SetNextClientThink( CLIENT_THINK_NEVER );

	return true;
}
nsresult 
nsHTMLEditor::ShowResizersInner(nsIDOMElement *aResizedElement)
{
  NS_ENSURE_ARG_POINTER(aResizedElement);
  nsresult res;

  nsCOMPtr<nsIDOMNode> parentNode;
  res = aResizedElement->GetParentNode(getter_AddRefs(parentNode));
  NS_ENSURE_SUCCESS(res, res);

  if (mResizedObject) {
    NS_ERROR("call HideResizers first");
    return NS_ERROR_UNEXPECTED;
  }
  mResizedObject = aResizedElement;

  // The resizers and the shadow will be anonymous siblings of the element.
  res = CreateResizer(getter_AddRefs(mTopLeftHandle),
                      nsIHTMLObjectResizer::eTopLeft,     parentNode);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mTopHandle),
                      nsIHTMLObjectResizer::eTop,         parentNode);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mTopRightHandle),
                      nsIHTMLObjectResizer::eTopRight,    parentNode);
  if (NS_FAILED(res)) return res;

  res = CreateResizer(getter_AddRefs(mLeftHandle),
                      nsIHTMLObjectResizer::eLeft,        parentNode);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mRightHandle),
                      nsIHTMLObjectResizer::eRight,       parentNode);
  if (NS_FAILED(res)) return res;

  res = CreateResizer(getter_AddRefs(mBottomLeftHandle),
                      nsIHTMLObjectResizer::eBottomLeft,  parentNode);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mBottomHandle),
                      nsIHTMLObjectResizer::eBottom,      parentNode);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mBottomRightHandle),
                      nsIHTMLObjectResizer::eBottomRight, parentNode);
  if (NS_FAILED(res)) return res;

  res = GetPositionAndDimensions(aResizedElement,
                                 mResizedObjectX,
                                 mResizedObjectY,
                                 mResizedObjectWidth,
                                 mResizedObjectHeight,
                                 mResizedObjectBorderLeft,
                                 mResizedObjectBorderTop,
                                 mResizedObjectMarginLeft,
                                 mResizedObjectMarginTop);
  if (NS_FAILED(res)) return res;

  // and let's set their absolute positions in the document
  res = SetAllResizersPosition();
  if (NS_FAILED(res)) return res;

  // now, let's create the resizing shadow
  res = CreateShadow(getter_AddRefs(mResizingShadow), parentNode,
                     aResizedElement);
  if (NS_FAILED(res)) return res;
  // and set its position
  res = SetShadowPosition(mResizingShadow, mResizedObject,
                          mResizedObjectX, mResizedObjectY);
  if (NS_FAILED(res)) return res;

  // and then the resizing info tooltip
  res = CreateResizingInfo(getter_AddRefs(mResizingInfo), parentNode);
  if (NS_FAILED(res)) return res;

  // and listen to the "resize" event on the window first, get the
  // window from the document...
  nsCOMPtr<nsIDOMDocument> domDoc;
  GetDocument(getter_AddRefs(domDoc));
  nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
  if (!doc) return NS_ERROR_NULL_POINTER;

  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
  if (!target) { return NS_ERROR_NULL_POINTER; }

  mResizeEventListenerP = new DocumentResizeEventListener(this);
  if (!mResizeEventListenerP) { return NS_ERROR_OUT_OF_MEMORY; }
  res = target->AddEventListener(NS_LITERAL_STRING("resize"), mResizeEventListenerP, PR_FALSE);

  aResizedElement->SetAttribute(NS_LITERAL_STRING("_moz_resizing"), NS_LITERAL_STRING("true"));
  return res;
}
예제 #11
0
bool C_ASW_PropJeep_Clientside::Initialize()
{
	SetModelName( VEHICLE_MODEL );
	PrecacheModel(VEHICLE_MODEL);
	SetModel(VEHICLE_MODEL);
	if ( InitializeAsClientEntity( STRING(GetModelName()), false ) == false )
	{
		return false;
	}

	const model_t *mod = GetModel();
	if ( mod )
	{
		Vector mins, maxs;
		modelinfo->GetModelBounds( mod, mins, maxs );
		SetCollisionBounds( mins, maxs );
	}

	solid_t tmpSolid;

	// Create the object in the physics system

	if ( !PhysModelParseSolid( tmpSolid, this, GetModelIndex() ) )
	{
		DevMsg("C_ASW_PropJeep_Clientside::Initialize: PhysModelParseSolid failed for entity %i.\n", GetModelIndex() );
		return false;
	}
	else
	{
		m_pPhysicsObject = VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &tmpSolid );
	
		if ( !m_pPhysicsObject )
		{
			// failed to create a physics object
		DevMsg(" C_ASW_PropJeep_Clientside::Initialize: VPhysicsInitNormal() failed for %s.\n", STRING(GetModelName()) );
			return false;
		}
	}
		
	Spawn();
		
	if ( engine->IsInEditMode() )
	{
		// don't spawn in map edit mode
		return false;
	}

	// player can push it away
	SetCollisionGroup( COLLISION_GROUP_VEHICLE );

	UpdatePartitionListEntry();

	CollisionProp()->UpdatePartition();

	//SetBlocksLOS( false ); // this should be a small object

	// Set up shadows; do it here so that objects can change shadowcasting state
	CreateShadow();

	UpdateVisibility();

	SetNextClientThink( gpGlobals->curtime + 0.4f  );

	return true;
}
예제 #12
0
nsresult
HTMLEditor::ShowResizersInner(Element& aResizedElement)
{
  if (mResizedObject) {
    NS_ERROR("call HideResizers first");
    return NS_ERROR_UNEXPECTED;
  }

  nsCOMPtr<nsIContent> parentContent = aResizedElement.GetParent();
  if (NS_WARN_IF(!parentContent)) {
   return NS_ERROR_FAILURE;
  }

  mResizedObject = &aResizedElement;

  // The resizers and the shadow will be anonymous siblings of the element.
  mTopLeftHandle =
    CreateResizer(nsIHTMLObjectResizer::eTopLeft, *parentContent);
  NS_ENSURE_TRUE(mTopLeftHandle, NS_ERROR_FAILURE);
  mTopHandle = CreateResizer(nsIHTMLObjectResizer::eTop, *parentContent);
  NS_ENSURE_TRUE(mTopHandle, NS_ERROR_FAILURE);
  mTopRightHandle =
    CreateResizer(nsIHTMLObjectResizer::eTopRight, *parentContent);
  NS_ENSURE_TRUE(mTopRightHandle, NS_ERROR_FAILURE);

  mLeftHandle = CreateResizer(nsIHTMLObjectResizer::eLeft, *parentContent);
  NS_ENSURE_TRUE(mLeftHandle, NS_ERROR_FAILURE);
  mRightHandle = CreateResizer(nsIHTMLObjectResizer::eRight, *parentContent);
  NS_ENSURE_TRUE(mRightHandle, NS_ERROR_FAILURE);

  mBottomLeftHandle =
    CreateResizer(nsIHTMLObjectResizer::eBottomLeft, *parentContent);
  NS_ENSURE_TRUE(mBottomLeftHandle, NS_ERROR_FAILURE);
  mBottomHandle = CreateResizer(nsIHTMLObjectResizer::eBottom, *parentContent);
  NS_ENSURE_TRUE(mBottomHandle, NS_ERROR_FAILURE);
  mBottomRightHandle =
    CreateResizer(nsIHTMLObjectResizer::eBottomRight, *parentContent);
  NS_ENSURE_TRUE(mBottomRightHandle, NS_ERROR_FAILURE);

  nsresult rv =
    GetPositionAndDimensions(aResizedElement,
                             mResizedObjectX,
                             mResizedObjectY,
                             mResizedObjectWidth,
                             mResizedObjectHeight,
                             mResizedObjectBorderLeft,
                             mResizedObjectBorderTop,
                             mResizedObjectMarginLeft,
                             mResizedObjectMarginTop);
  NS_ENSURE_SUCCESS(rv, rv);

  // and let's set their absolute positions in the document
  rv = SetAllResizersPosition();
  NS_ENSURE_SUCCESS(rv, rv);

  // now, let's create the resizing shadow
  mResizingShadow = CreateShadow(*parentContent, aResizedElement);
  NS_ENSURE_TRUE(mResizingShadow, NS_ERROR_FAILURE);
  // and set its position
  rv = SetShadowPosition(mResizingShadow, &aResizedElement,
                         mResizedObjectX, mResizedObjectY);
  NS_ENSURE_SUCCESS(rv, rv);

  // and then the resizing info tooltip
  mResizingInfo = CreateResizingInfo(*parentContent);
  NS_ENSURE_TRUE(mResizingInfo, NS_ERROR_FAILURE);

  // and listen to the "resize" event on the window first, get the
  // window from the document...
  nsCOMPtr<nsIDocument> doc = GetDocument();
  NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);

  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
  if (!target) {
    return NS_ERROR_NULL_POINTER;
  }

  mResizeEventListenerP = new DocumentResizeEventListener(*this);
  rv = target->AddEventListener(NS_LITERAL_STRING("resize"),
                                mResizeEventListenerP, false);
  if (NS_WARN_IF(NS_FAILED(rv))) {
    return rv;
  }
  // XXX Even when it failed to add event listener, should we need to set
  //     _moz_resizing attribute?
  aResizedElement.SetAttr(kNameSpaceID_None, nsGkAtoms::_moz_resizing,
                          NS_LITERAL_STRING("true"), true);

  MOZ_ASSERT(mResizedObject == &aResizedElement);

  return NS_OK;
}
예제 #13
0
//=============================================================================
// 初期化処理
//=============================================================================
HRESULT InitModel(LPDIRECT3DDEVICE9 pDevice)
{
	//LPDIRECT3DDEVICE9 pDevice = GetDevice();
	
	Player.pD3DXMeshModel = NULL;
	//Player.pD3DXBuffMatModel = NULL;
	Player.nNumMatModel  = 0;
	
	//位置、回転、スケールの初期設定
	Player.posModel = DEFAULTPLAYER_POS;
	Player.rotModel = D3DXVECTOR3(0.0f,0.0f,0.0f);
	Player.scaleModel = D3DXVECTOR3(10.0f,10.0f,10.0f);

	Player.bPlayerMove = true;
	
	LPD3DXBUFFER	pMatBuf	= NULL;

	//Xファイル読み込み
	if(FAILED(D3DXLoadMeshFromX(
		FILE_NAME,				//Xファイル名
		D3DXMESH_SYSTEMMEM,		//メッシュ作成のオプション
		pDevice,				//デバイスへのポインタ
		NULL,					//隣接性データを含むバッファへのポインタ
		&Player.pD3DXBuffMatModel,	//マテリアルデータを含むバッファ
		NULL,					//エフェクトインスタンスへの配列を含むポインタ
		&Player.nNumMatModel,		//D3DXMATERIAL構造体の数
		&Player.pD3DXMeshModel		//メッシュのポインタ
	))){
		return E_FAIL;
	}

	if(!(Player.pD3DXMeshModel->GetFVF() & D3DFVF_NORMAL)){
		ID3DXMesh * pTempMesh = NULL;
		Player.pD3DXMeshModel->CloneMeshFVF(Player.pD3DXMeshModel->GetOptions(),
			Player.pD3DXMeshModel->GetFVF() | D3DFVF_NORMAL,
			pDevice,
			&pTempMesh);
		D3DXComputeNormals(pTempMesh, NULL);
		Player.pD3DXMeshModel->Release();
		Player.pD3DXMeshModel = pTempMesh;
	}
	Player.pMeshMat = new D3DMATERIAL9[Player.nNumMatModel];
	Player.pMeshTex = new LPDIRECT3DTEXTURE9[Player.nNumMatModel];
	D3DXMATERIAL * d3Mat = (D3DXMATERIAL *)Player.pD3DXBuffMatModel->GetBufferPointer();
	for(unsigned int i = 0; i < Player.nNumMatModel; i++){
		Player.pMeshMat[i] = d3Mat[i].MatD3D;
		Player.pMeshMat[i].Ambient = Player.pMeshMat[i].Diffuse;
		Player.pMeshTex[i] = NULL;

		//使用しているテクスチャがあれば読み込む
		if(d3Mat[i].pTextureFilename != NULL &&
			lstrlen(d3Mat[i].pTextureFilename) > 0)
		{
			if(FAILED(D3DXCreateTextureFromFile(
						pDevice,
						d3Mat[i].pTextureFilename,
						&Player.pMeshTex[i])))
						{
							return E_FAIL;
						}
		}
	}

	Player.posModel = DEFAULTPLAYER_POS;
	Player.rotModel = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
	Player.scaleModel = D3DXVECTOR3(10.0f, 10.0f, 10.0f);

	// 影の成分
	Player.nIdxShadow = CreateShadow( Player.posModel, 25.0f, 25.0f);
	
	//pMatBuf->Release();

	return S_OK;
}
예제 #14
0
NS_IMETHODIMP 
nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
{
  NS_ENSURE_ARG_POINTER(aResizedElement);
  mResizedObject = aResizedElement;

  // the resizers and the shadow will be anonymous children of the body
  nsIDOMElement *bodyElement = GetRoot();
  if (!bodyElement)   return NS_ERROR_NULL_POINTER;

  // let's create the resizers
  nsresult res;
  res = CreateResizer(getter_AddRefs(mTopLeftHandle),
                      nsIHTMLObjectResizer::eTopLeft,     bodyElement);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mTopHandle),
                      nsIHTMLObjectResizer::eTop,         bodyElement);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mTopRightHandle),
                      nsIHTMLObjectResizer::eTopRight,    bodyElement);
  if (NS_FAILED(res)) return res;

  res = CreateResizer(getter_AddRefs(mLeftHandle),
                      nsIHTMLObjectResizer::eLeft,        bodyElement);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mRightHandle),
                      nsIHTMLObjectResizer::eRight,       bodyElement);
  if (NS_FAILED(res)) return res;

  res = CreateResizer(getter_AddRefs(mBottomLeftHandle),
                      nsIHTMLObjectResizer::eBottomLeft,  bodyElement);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mBottomHandle),
                      nsIHTMLObjectResizer::eBottom,      bodyElement);
  if (NS_FAILED(res)) return res;
  res = CreateResizer(getter_AddRefs(mBottomRightHandle),
                      nsIHTMLObjectResizer::eBottomRight, bodyElement);
  if (NS_FAILED(res)) return res;

  res = GetPositionAndDimensions(aResizedElement,
                                 mResizedObjectX,
                                 mResizedObjectY,
                                 mResizedObjectWidth,
                                 mResizedObjectHeight,
                                 mResizedObjectBorderLeft,
                                 mResizedObjectBorderTop,
                                 mResizedObjectMarginLeft,
                                 mResizedObjectMarginTop);
  if (NS_FAILED(res)) return res;

  // and let's set their absolute positions in the document
  res = SetAllResizersPosition();
  if (NS_FAILED(res)) return res;

  // now, let's create the resizing shadow
  res = CreateShadow(getter_AddRefs(mResizingShadow), bodyElement,
                     aResizedElement);
  if (NS_FAILED(res)) return res;
  // and set its position
  res = SetShadowPosition(mResizingShadow, mResizedObject,
                          mResizedObjectX, mResizedObjectY);
  if (NS_FAILED(res)) return res;

  // and then the resizing info tooltip
  res = CreateResizingInfo(getter_AddRefs(mResizingInfo), bodyElement);
  if (NS_FAILED(res)) return res;


  // and listen to the "resize" event on the window
  // first, get the script global object from the document...
  nsCOMPtr<nsIDOMDocument> domDoc;
  GetDocument(getter_AddRefs(domDoc));
  nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
  if (!doc) return NS_ERROR_NULL_POINTER;

  nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
  if (!global) { return NS_ERROR_NULL_POINTER; }

  mResizeEventListenerP = new DocumentResizeEventListener(this);
  if (!mResizeEventListenerP) { return NS_ERROR_OUT_OF_MEMORY; }
  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(global);
  res = target->AddEventListener(NS_LITERAL_STRING("resize"), mResizeEventListenerP, PR_FALSE);

  aResizedElement->SetAttribute(NS_LITERAL_STRING("_moz_resizing"), NS_LITERAL_STRING("true"));
  return res;
}