зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to fx-team
This commit is contained in:
Коммит
4bb94f35b0
|
@ -528,7 +528,7 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
static_cast<unsigned>(index) < newRetainedTiles.Length(),
|
||||
"index out of range");
|
||||
|
||||
Tile& newTile = newRetainedTiles[index];
|
||||
Tile newTile = newRetainedTiles[index];
|
||||
|
||||
// Try to reuse a tile from the old retained tiles that had no partially
|
||||
// valid content.
|
||||
|
@ -544,12 +544,14 @@ TiledLayerBuffer<Derived, Tile>::Update(const nsIntRegion& newValidRegion,
|
|||
// in which case it's up to the derived class's ValidateTile()
|
||||
// implementation to allocate a new tile before drawing
|
||||
nsIntPoint tileOrigin(tileStartX, tileStartY);
|
||||
AsDerived().ValidateTile(newTile, nsIntPoint(tileStartX, tileStartY),
|
||||
tileDrawRegion);
|
||||
newTile = AsDerived().ValidateTile(newTile, nsIntPoint(tileStartX, tileStartY),
|
||||
tileDrawRegion);
|
||||
NS_ASSERTION(!newTile.IsPlaceholderTile(), "Unexpected placeholder tile - failed to allocate?");
|
||||
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
||||
printf_stderr("Store Validate tile %i, %i -> %i\n", tileStartX, tileStartY, index);
|
||||
#endif
|
||||
newRetainedTiles[index] = newTile;
|
||||
|
||||
y += height;
|
||||
}
|
||||
|
||||
|
|
|
@ -391,13 +391,18 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
|
|||
gfx::Rect *aClipRectOut /* = nullptr */,
|
||||
gfx::Rect *aRenderBoundsOut /* = nullptr */)
|
||||
{
|
||||
mWidgetSize = mWidget->GetClientSize();
|
||||
IntRect intRect = gfx::IntRect(IntPoint(), mWidgetSize);
|
||||
nsIntRect intRect;
|
||||
mWidget->GetClientBounds(intRect);
|
||||
mWidgetSize = gfx::ToIntSize(intRect.Size());
|
||||
|
||||
// The result of GetClientBounds is shifted over by the size of the window
|
||||
// manager styling. We want to ignore that.
|
||||
intRect.MoveTo(0, 0);
|
||||
Rect rect = Rect(0, 0, intRect.width, intRect.height);
|
||||
|
||||
// Sometimes the invalid region is larger than we want to draw.
|
||||
nsIntRegion invalidRegionSafe;
|
||||
invalidRegionSafe.And(aInvalidRegion, gfx::ThebesIntRect(intRect));
|
||||
invalidRegionSafe.And(aInvalidRegion, intRect);
|
||||
|
||||
nsIntRect invalidRect = invalidRegionSafe.GetBounds();
|
||||
mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);
|
||||
|
|
|
@ -1059,7 +1059,7 @@ ClientTiledLayerBuffer::PostValidate(const nsIntRegion& aPaintRegion)
|
|||
}
|
||||
|
||||
void
|
||||
ClientTiledLayerBuffer::UnlockTile(TileClient& aTile)
|
||||
ClientTiledLayerBuffer::UnlockTile(TileClient aTile)
|
||||
{
|
||||
// We locked the back buffer, and flipped so we now need to unlock the front
|
||||
if (aTile.mFrontBuffer && aTile.mFrontBuffer->IsLocked()) {
|
||||
|
@ -1078,8 +1078,8 @@ ClientTiledLayerBuffer::UnlockTile(TileClient& aTile)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
||||
TileClient
|
||||
ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
|
||||
const nsIntPoint& aTileOrigin,
|
||||
const nsIntRegion& aDirtyRegion)
|
||||
{
|
||||
|
@ -1120,24 +1120,27 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
|
||||
if (!backBuffer) {
|
||||
NS_WARNING("Failed to allocate a tile TextureClient");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardBackBuffer();
|
||||
aTile.DiscardFrontBuffer();
|
||||
return TileClient();
|
||||
}
|
||||
|
||||
// the back buffer may have been already locked in ValidateBackBufferFromFront
|
||||
if (!backBuffer->IsLocked()) {
|
||||
if (!backBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
|
||||
NS_WARNING("Failed to lock a tile TextureClient");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardBackBuffer();
|
||||
aTile.DiscardFrontBuffer();
|
||||
return TileClient();
|
||||
}
|
||||
}
|
||||
|
||||
if (backBufferOnWhite && !backBufferOnWhite->IsLocked()) {
|
||||
if (!backBufferOnWhite->Lock(OpenMode::OPEN_READ_WRITE)) {
|
||||
NS_WARNING("Failed to lock tile TextureClient for updating.");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardBackBuffer();
|
||||
aTile.DiscardFrontBuffer();
|
||||
return TileClient();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,13 +1148,15 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
if (createdTextureClient) {
|
||||
if (!mCompositableClient->AddTextureClient(backBuffer)) {
|
||||
NS_WARNING("Failed to add tile TextureClient.");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardFrontBuffer();
|
||||
aTile.DiscardBackBuffer();
|
||||
return aTile;
|
||||
}
|
||||
if (backBufferOnWhite && !mCompositableClient->AddTextureClient(backBufferOnWhite)) {
|
||||
NS_WARNING("Failed to add tile TextureClient.");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardFrontBuffer();
|
||||
aTile.DiscardBackBuffer();
|
||||
return aTile;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1167,9 +1172,9 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
}
|
||||
moz2DTile.mTileOrigin = gfx::IntPoint(aTileOrigin.x, aTileOrigin.y);
|
||||
if (!dt || (backBufferOnWhite && !dtOnWhite)) {
|
||||
NS_WARNING("Failed to get a DrawTarget from a tile");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardFrontBuffer();
|
||||
aTile.DiscardBackBuffer();
|
||||
return aTile;
|
||||
}
|
||||
|
||||
mMoz2DTiles.push_back(moz2DTile);
|
||||
|
@ -1202,7 +1207,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
|
||||
aTile.Flip();
|
||||
|
||||
return;
|
||||
return aTile;
|
||||
}
|
||||
|
||||
// Single paint buffer case:
|
||||
|
@ -1286,8 +1291,9 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
if (createdTextureClient) {
|
||||
if (!mCompositableClient->AddTextureClient(backBuffer)) {
|
||||
NS_WARNING("Failed to add tile TextureClient.");
|
||||
aTile.Release();
|
||||
return;
|
||||
aTile.DiscardFrontBuffer();
|
||||
aTile.DiscardBackBuffer();
|
||||
return aTile;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1301,6 +1307,8 @@ ClientTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
|||
// TextureClient around unnecessarily, so discard the back-buffer.
|
||||
aTile.DiscardBackBuffer();
|
||||
}
|
||||
|
||||
return aTile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -440,15 +440,15 @@ public:
|
|||
SurfaceDescriptorTiles GetSurfaceDescriptorTiles();
|
||||
|
||||
protected:
|
||||
void ValidateTile(TileClient& aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
const nsIntRegion& dirtyRect);
|
||||
TileClient ValidateTile(TileClient aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
const nsIntRegion& dirtyRect);
|
||||
|
||||
void PostValidate(const nsIntRegion& aPaintRegion);
|
||||
|
||||
void UnlockTile(TileClient& aTile);
|
||||
void UnlockTile(TileClient aTile);
|
||||
|
||||
void ReleaseTile(TileClient& aTile) { aTile.Release(); }
|
||||
void ReleaseTile(TileClient aTile) { aTile.Release(); }
|
||||
|
||||
void SwapTiles(TileClient& aTileA, TileClient& aTileB) { std::swap(aTileA, aTileB); }
|
||||
|
||||
|
|
|
@ -168,14 +168,14 @@ TiledLayerBufferComposite::Upload()
|
|||
ClearPaintedRegion();
|
||||
}
|
||||
|
||||
void
|
||||
TiledLayerBufferComposite::ValidateTile(TileHost& aTile,
|
||||
TileHost
|
||||
TiledLayerBufferComposite::ValidateTile(TileHost aTile,
|
||||
const nsIntPoint& aTileOrigin,
|
||||
const nsIntRegion& aDirtyRect)
|
||||
{
|
||||
if (aTile.IsPlaceholderTile()) {
|
||||
NS_WARNING("Placeholder tile encountered in painted region");
|
||||
return;
|
||||
return aTile;
|
||||
}
|
||||
|
||||
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
||||
|
@ -205,6 +205,7 @@ TiledLayerBufferComposite::ValidateTile(TileHost& aTile,
|
|||
printf_stderr("Tile Time to upload %i\n", PR_IntervalNow() - start);
|
||||
}
|
||||
#endif
|
||||
return aTile;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -164,9 +164,9 @@ public:
|
|||
static void RecycleCallback(TextureHost* textureHost, void* aClosure);
|
||||
|
||||
protected:
|
||||
void ValidateTile(TileHost& aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
const nsIntRegion& dirtyRect);
|
||||
TileHost ValidateTile(TileHost aTile,
|
||||
const nsIntPoint& aTileRect,
|
||||
const nsIntRegion& dirtyRect);
|
||||
|
||||
// do nothing, the desctructor in the texture host takes care of releasing resources
|
||||
void ReleaseTile(TileHost aTile) {}
|
||||
|
|
|
@ -36,11 +36,11 @@ public:
|
|||
return TestTiledLayerTile(-1);
|
||||
}
|
||||
|
||||
void ValidateTile(TestTiledLayerTile& aTile, const nsIntPoint& aTileOrigin, const nsIntRegion& aDirtyRect) {
|
||||
aTile = TestTiledLayerTile();
|
||||
TestTiledLayerTile ValidateTile(TestTiledLayerTile aTile, const nsIntPoint& aTileOrigin, const nsIntRegion& aDirtyRect) {
|
||||
return TestTiledLayerTile();
|
||||
}
|
||||
|
||||
void ReleaseTile(TestTiledLayerTile& aTile)
|
||||
void ReleaseTile(TestTiledLayerTile aTile)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
Update(aNewValidRegion, aPaintRegion);
|
||||
}
|
||||
|
||||
void UnlockTile(TestTiledLayerTile& aTile) {}
|
||||
void UnlockTile(TestTiledLayerTile aTile) {}
|
||||
void PostValidate(const nsIntRegion& aPaintRegion) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "mozilla/TextEvents.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
|
||||
#include "prlink.h"
|
||||
#include "nsGTKToolkit.h"
|
||||
#include "nsIRollupListener.h"
|
||||
|
@ -1527,12 +1525,6 @@ nsWindow::GetScreenBounds(nsIntRect &aRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
gfx::IntSize
|
||||
nsWindow::GetClientSize()
|
||||
{
|
||||
return gfx::IntSize(mBounds.width, mBounds.height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::GetClientBounds(nsIntRect &aRect)
|
||||
{
|
||||
|
@ -1548,8 +1540,6 @@ nsWindow::GetClientBounds(nsIntRect &aRect)
|
|||
nsIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
PROFILER_LABEL("nsWindow", "GetClientOffset", js::ProfileEntry::Category::GRAPHICS);
|
||||
|
||||
if (!mIsTopLevel) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,6 @@ public:
|
|||
NS_IMETHOD SetFocus(bool aRaise = false) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect) MOZ_OVERRIDE;
|
||||
virtual gfx::IntSize GetClientSize() MOZ_OVERRIDE;
|
||||
virtual nsIntPoint GetClientOffset() MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
// forward declarations
|
||||
class nsFontMetrics;
|
||||
|
@ -1277,18 +1276,6 @@ class nsIWidget : public nsISupports {
|
|||
*/
|
||||
virtual nsIntPoint GetClientOffset() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Equivalent to GetClientBounds but only returns the size.
|
||||
*/
|
||||
virtual mozilla::gfx::IntSize GetClientSize() {
|
||||
// Dependeing on the backend, overloading this method may be useful if
|
||||
// if requesting the client offset is expensive.
|
||||
nsIntRect rect;
|
||||
GetClientBounds(rect);
|
||||
return mozilla::gfx::IntSize(rect.width, rect.height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the background color for this widget
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче