зеркало из https://github.com/mozilla/gecko-dev.git
Bug 225984 DRefTool analysis for beos files
r=roc sr=roc
This commit is contained in:
Родитель
4fe5f830f7
Коммит
bfe76024bf
|
@ -134,6 +134,8 @@ NS_IMETHODIMP nsFontMetricsBeOS::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
PRInt16 face = 0;
|
||||
|
||||
mFont = new nsFont(aFont);
|
||||
if (!mFont)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
float app2dev, app2twip;
|
||||
aContext->GetAppUnitsToDevUnits(app2dev);
|
||||
|
|
|
@ -81,7 +81,7 @@ nsRenderingContextBeOS::~nsRenderingContextBeOS() {
|
|||
mStateCache = nsnull;
|
||||
}
|
||||
|
||||
if (mTranMatrix) delete mTranMatrix;
|
||||
delete mTranMatrix;
|
||||
NS_IF_RELEASE(mOffscreenSurface);
|
||||
NS_IF_RELEASE(mFontMetrics);
|
||||
NS_IF_RELEASE(mContext);
|
||||
|
@ -113,11 +113,14 @@ NS_IMETHODIMP nsRenderingContextBeOS::Init(nsIDeviceContext *aContext, nsDrawing
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextBeOS::CommonInit() {
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
return NS_OK;
|
||||
if (!mTranMatrix)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We like PRUnichar rendering, hopefully it's not slowing us too much
|
||||
|
@ -167,28 +170,40 @@ NS_IMETHODIMP nsRenderingContextBeOS::GetDeviceContext(nsIDeviceContext *&aConte
|
|||
// Get a new GS
|
||||
NS_IMETHODIMP nsRenderingContextBeOS::PushState() {
|
||||
#ifdef USE_GS_POOL
|
||||
nsGraphicsState *state = nsGraphicsStatePool::GetNewGS();
|
||||
nsGraphicsState *state = nsGraphicsStatePool::GetNewGS();
|
||||
#else
|
||||
nsGraphicsState *state = new nsGraphicsState;
|
||||
nsGraphicsState *state = new nsGraphicsState;
|
||||
#endif
|
||||
// Push into this state object, add to vector
|
||||
if (!state) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
// Push into this state object, add to vector
|
||||
if (!state) return NS_ERROR_FAILURE;
|
||||
|
||||
state->mMatrix = mTranMatrix;
|
||||
if (nsnull == mTranMatrix) mTranMatrix = new nsTransform2D();
|
||||
else mTranMatrix = new nsTransform2D(mTranMatrix);
|
||||
|
||||
// Set state to mClipRegion. SetClip{Rect,Region}() will do copy-on-write stuff
|
||||
state->mClipRegion = mClipRegion;
|
||||
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
state->mFontMetrics = mFontMetrics;
|
||||
state->mColor = mCurrentColor;
|
||||
state->mLineStyle = mCurrentLineStyle;
|
||||
|
||||
mStateCache->AppendElement(state);
|
||||
return NS_OK;
|
||||
nsTransform2D *tranMatrix;
|
||||
if (nsnull == mTranMatrix)
|
||||
tranMatrix = new nsTransform2D();
|
||||
else
|
||||
tranMatrix = new nsTransform2D(mTranMatrix);
|
||||
|
||||
if (!tranMatrix) {
|
||||
#ifdef USE_GS_POOL
|
||||
nsGraphicsStatePool::ReleaseGS(state);
|
||||
#else
|
||||
delete state;
|
||||
#endif
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
state->mMatrix = mTranMatrix;
|
||||
mTranMatrix = tranMatrix;
|
||||
|
||||
// Set state to mClipRegion. SetClip{Rect,Region}() will do copy-on-write stuff
|
||||
state->mClipRegion = mClipRegion;
|
||||
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
state->mFontMetrics = mFontMetrics;
|
||||
state->mColor = mCurrentColor;
|
||||
state->mLineStyle = mCurrentLineStyle;
|
||||
|
||||
mStateCache->AppendElement(state);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextBeOS::PopState(PRBool &aClipEmpty) {
|
||||
|
@ -201,7 +216,7 @@ NS_IMETHODIMP nsRenderingContextBeOS::PopState(PRBool &aClipEmpty) {
|
|||
|
||||
// Assign all local attributes from the state object just popped
|
||||
if (state->mMatrix) {
|
||||
if (mTranMatrix) delete mTranMatrix;
|
||||
delete mTranMatrix;
|
||||
mTranMatrix = state->mMatrix;
|
||||
}
|
||||
|
||||
|
|
|
@ -432,12 +432,12 @@ void nsAppShell::RetrieveAllEvents(bool blockable)
|
|||
while(true)
|
||||
{
|
||||
EventItem *newitem = new EventItem;
|
||||
if ( !newitem ) break;
|
||||
|
||||
newitem->code = 0;
|
||||
newitem->ifdata.data = nsnull;
|
||||
newitem->ifdata.sync = 0;
|
||||
|
||||
if ( !newitem ) break;
|
||||
|
||||
// only block on read_port when
|
||||
// blockable == true
|
||||
// and
|
||||
|
|
|
@ -1247,31 +1247,31 @@ nsIFontMetrics* nsWindow::GetFont(void)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsWindow::SetFont(const nsFont &aFont)
|
||||
{
|
||||
// Cache Font for owner draw
|
||||
if (mFont == nsnull) {
|
||||
mFont = new nsFont(aFont);
|
||||
} else {
|
||||
*mFont = aFont;
|
||||
}
|
||||
// Cache Font for owner draw
|
||||
if (mFont == nsnull) {
|
||||
if (!(mFont = new nsFont(aFont)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
*mFont = aFont;
|
||||
}
|
||||
|
||||
// Bail out if there is no context
|
||||
if (nsnull == mContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Bail out if there is no context
|
||||
if (nsnull == mContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsIFontMetrics* metrics;
|
||||
mContext->GetMetricsFor(aFont, metrics);
|
||||
nsFontHandle fontHandle;
|
||||
metrics->GetFontHandle(fontHandle);
|
||||
BFont *font = (BFont*)fontHandle;
|
||||
if(font && mView && mView->LockLooper())
|
||||
{
|
||||
mView->SetFont(font, B_FONT_ALL);
|
||||
mView->UnlockLooper();
|
||||
}
|
||||
NS_RELEASE(metrics);
|
||||
nsCOMPtr<nsIFontMetrics> metrics;
|
||||
mContext->GetMetricsFor(aFont, getter_AddRefs(metrics));
|
||||
nsFontHandle fontHandle;
|
||||
metrics->GetFontHandle(fontHandle);
|
||||
BFont *font = (BFont*)fontHandle;
|
||||
if(font && mView && mView->LockLooper())
|
||||
{
|
||||
mView->SetFont(font, B_FONT_ALL);
|
||||
mView->UnlockLooper();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -148,33 +148,34 @@ nsSplashScreenBeOS::Observe(nsISupports *aSubject,
|
|||
const char *aTopic,
|
||||
const PRUnichar *someData)
|
||||
{
|
||||
if (!bitmap) return NS_OK;
|
||||
nsCAutoString statusString;
|
||||
statusString.AssignWithConversion(someData);
|
||||
if (textView == NULL) {
|
||||
BRect textRect = bitmap->Bounds();
|
||||
// Reduce the view size, and take into account the image frame
|
||||
textRect.bottom -= 10;
|
||||
textRect.left += 10;
|
||||
textRect.right -= 10;
|
||||
textRect.top = textRect.bottom - 20;
|
||||
textView = new BStringView(textRect,
|
||||
"splash text",
|
||||
statusString.get(),
|
||||
B_FOLLOW_LEFT | B_FOLLOW_V_CENTER);
|
||||
textView->SetViewColor(B_TRANSPARENT_COLOR);
|
||||
textView->SetHighColor(255,255,255,0);
|
||||
textView->SetLowColor(0,0,0,0);
|
||||
if (textView != NULL) {
|
||||
window->AddChild(textView);
|
||||
}
|
||||
} else {
|
||||
if (textView->LockLooper()) {
|
||||
textView->SetText(statusString.get());
|
||||
textView->UnlockLooper();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
if (!bitmap) return NS_OK;
|
||||
nsCAutoString statusString;
|
||||
statusString.AssignWithConversion(someData);
|
||||
if (textView == NULL) {
|
||||
BRect textRect = bitmap->Bounds();
|
||||
textView = new BStringView(textRect,
|
||||
"splash text",
|
||||
statusString.get(),
|
||||
B_FOLLOW_LEFT | B_FOLLOW_V_CENTER);
|
||||
if (textView) {
|
||||
// Reduce the view size, and take into account the image frame
|
||||
textRect.bottom -= 10;
|
||||
textRect.left += 10;
|
||||
textRect.right -= 10;
|
||||
textRect.top = textRect.bottom - 20;
|
||||
|
||||
textView->SetViewColor(B_TRANSPARENT_COLOR);
|
||||
textView->SetHighColor(255,255,255,0);
|
||||
textView->SetLowColor(0,0,0,0);
|
||||
window->AddChild(textView);
|
||||
}
|
||||
} else {
|
||||
if (textView->LockLooper()) {
|
||||
textView->SetText(statusString.get());
|
||||
textView->UnlockLooper();
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
Загрузка…
Ссылка в новой задаче