зеркало из https://github.com/mozilla/gecko-dev.git
b=792305 delay shape mask update from resize to expose r=roc
--HG-- extra : rebase_source : 6b00c1e4d31fc1d5b6dc4d09882591da82dc622d
This commit is contained in:
Родитель
b83a189ea1
Коммит
84c46e7900
|
@ -2367,18 +2367,12 @@ nsWindow::OnSizeAllocate(GtkWidget *aWidget, GtkAllocation *aAllocation)
|
|||
nsIntRect rect(aAllocation->x, aAllocation->y,
|
||||
aAllocation->width, aAllocation->height);
|
||||
|
||||
ResizeTransparencyBitmap(rect.width, rect.height);
|
||||
|
||||
mBounds.width = rect.width;
|
||||
mBounds.height = rect.height;
|
||||
|
||||
if (!mGdkWindow)
|
||||
return;
|
||||
|
||||
if (mTransparencyBitmap) {
|
||||
ApplyTransparencyBitmap();
|
||||
}
|
||||
|
||||
if (mWidgetListener)
|
||||
mWidgetListener->WindowResized(this, rect.width, rect.height);
|
||||
}
|
||||
|
@ -3809,8 +3803,6 @@ nsWindow::NativeResize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
|||
LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
|
||||
aWidth, aHeight));
|
||||
|
||||
ResizeTransparencyBitmap(aWidth, aHeight);
|
||||
|
||||
// clear our resize flag
|
||||
mNeedsResize = false;
|
||||
|
||||
|
@ -3843,8 +3835,6 @@ nsWindow::NativeResize(int32_t aX, int32_t aY,
|
|||
LOG(("nsWindow::NativeResize [%p] %d %d %d %d\n", (void *)this,
|
||||
aX, aY, aWidth, aHeight));
|
||||
|
||||
ResizeTransparencyBitmap(aWidth, aHeight);
|
||||
|
||||
if (mIsTopLevel) {
|
||||
// aX and aY give the position of the window manager frame top-left.
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
|
@ -4197,32 +4187,25 @@ nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
|||
}
|
||||
|
||||
void
|
||||
nsWindow::ResizeTransparencyBitmap(int32_t aNewWidth, int32_t aNewHeight)
|
||||
nsWindow::ResizeTransparencyBitmap()
|
||||
{
|
||||
if (!mTransparencyBitmap)
|
||||
return;
|
||||
|
||||
if (aNewWidth == mTransparencyBitmapWidth &&
|
||||
aNewHeight == mTransparencyBitmapHeight)
|
||||
if (mBounds.width == mTransparencyBitmapWidth &&
|
||||
mBounds.height == mTransparencyBitmapHeight)
|
||||
return;
|
||||
|
||||
int32_t newSize = GetBitmapStride(aNewWidth)*aNewHeight;
|
||||
int32_t newRowBytes = GetBitmapStride(mBounds.width);
|
||||
int32_t newSize = newRowBytes * mBounds.height;
|
||||
gchar* newBits = new gchar[newSize];
|
||||
if (!newBits) {
|
||||
delete[] mTransparencyBitmap;
|
||||
mTransparencyBitmap = nullptr;
|
||||
mTransparencyBitmapWidth = 0;
|
||||
mTransparencyBitmapHeight = 0;
|
||||
return;
|
||||
}
|
||||
// fill new mask with "opaque", first
|
||||
memset(newBits, 255, newSize);
|
||||
// fill new mask with "transparent", first
|
||||
memset(newBits, 0, newSize);
|
||||
|
||||
// Now copy the intersection of the old and new areas into the new mask
|
||||
int32_t copyWidth = NS_MIN(aNewWidth, mTransparencyBitmapWidth);
|
||||
int32_t copyHeight = NS_MIN(aNewHeight, mTransparencyBitmapHeight);
|
||||
int32_t copyWidth = NS_MIN(mBounds.width, mTransparencyBitmapWidth);
|
||||
int32_t copyHeight = NS_MIN(mBounds.height, mTransparencyBitmapHeight);
|
||||
int32_t oldRowBytes = GetBitmapStride(mTransparencyBitmapWidth);
|
||||
int32_t newRowBytes = GetBitmapStride(aNewWidth);
|
||||
int32_t copyBytes = GetBitmapStride(copyWidth);
|
||||
|
||||
int32_t i;
|
||||
|
@ -4236,8 +4219,8 @@ nsWindow::ResizeTransparencyBitmap(int32_t aNewWidth, int32_t aNewHeight)
|
|||
|
||||
delete[] mTransparencyBitmap;
|
||||
mTransparencyBitmap = newBits;
|
||||
mTransparencyBitmapWidth = aNewWidth;
|
||||
mTransparencyBitmapHeight = aNewHeight;
|
||||
mTransparencyBitmapWidth = mBounds.width;
|
||||
mTransparencyBitmapHeight = mBounds.height;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -4359,11 +4342,11 @@ nsWindow::UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
|
|||
if (mTransparencyBitmap == nullptr) {
|
||||
int32_t size = GetBitmapStride(mBounds.width)*mBounds.height;
|
||||
mTransparencyBitmap = new gchar[size];
|
||||
if (mTransparencyBitmap == nullptr)
|
||||
return NS_ERROR_FAILURE;
|
||||
memset(mTransparencyBitmap, 255, size);
|
||||
mTransparencyBitmapWidth = mBounds.width;
|
||||
mTransparencyBitmapHeight = mBounds.height;
|
||||
} else {
|
||||
ResizeTransparencyBitmap();
|
||||
}
|
||||
|
||||
NS_ASSERTION(aRect.x >= 0 && aRect.y >= 0
|
||||
|
|
|
@ -281,7 +281,7 @@ public:
|
|||
NS_IMETHOD OnIMEFocusChange(bool aFocus);
|
||||
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
|
||||
|
||||
void ResizeTransparencyBitmap(int32_t aNewWidth, int32_t aNewHeight);
|
||||
void ResizeTransparencyBitmap();
|
||||
void ApplyTransparencyBitmap();
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
||||
virtual nsTransparencyMode GetTransparencyMode();
|
||||
|
|
Загрузка…
Ссылка в новой задаче