Bug 1546856 - Group related functions and make GetLastPaintOffset static. r=miko

Differential Revision: https://phabricator.services.mozilla.com/D70243

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2020-04-09 16:32:50 +00:00
Родитель aac8c04b18
Коммит 568858e9ed
2 изменённых файлов: 24 добавлений и 27 удалений

Просмотреть файл

@ -2054,12 +2054,6 @@ class MaskImageData {
RefPtr<TextureClient> mTextureClient; RefPtr<TextureClient> mTextureClient;
}; };
static PaintedDisplayItemLayerUserData* GetPaintedDisplayItemLayerUserData(
Layer* aLayer) {
return static_cast<PaintedDisplayItemLayerUserData*>(
aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
}
/* static */ /* static */
void FrameLayerBuilder::Shutdown() { void FrameLayerBuilder::Shutdown() {
if (gMaskLayerImageCache) { if (gMaskLayerImageCache) {
@ -2171,13 +2165,30 @@ static void InvalidatePreTransformRect(PaintedLayer* aLayer,
InvalidatePostTransformRegion(aLayer, pixelRect, aTranslation); InvalidatePostTransformRegion(aLayer, pixelRect, aTranslation);
} }
static nsIntPoint GetTranslationForPaintedLayer(PaintedLayer* aLayer) { static PaintedDisplayItemLayerUserData* GetPaintedDisplayItemLayerUserData(
PaintedDisplayItemLayerUserData* data = Layer* aLayer) {
static_cast<PaintedDisplayItemLayerUserData*>( return static_cast<PaintedDisplayItemLayerUserData*>(
aLayer->GetUserData(&gPaintedDisplayItemLayerUserData)); aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
NS_ASSERTION(data, "Must be a tracked painted layer!"); }
return data->mTranslation; static nsIntPoint GetTranslationForPaintedLayer(PaintedLayer* aLayer) {
PaintedDisplayItemLayerUserData* layerData =
GetPaintedDisplayItemLayerUserData(aLayer);
NS_ASSERTION(layerData, "Must be a tracked painted layer!");
return layerData->mTranslation;
}
/**
* Get the translation transform that was in aLayer when we last painted. It's
* either the transform saved by ~FrameLayerBuilder(), or else the transform
* that's currently in the layer (which must be an integer translation).
*/
static nsIntPoint GetLastPaintOffset(PaintedLayer* aLayer) {
PaintedDisplayItemLayerUserData* layerData =
GetPaintedDisplayItemLayerUserData(aLayer);
MOZ_ASSERT(layerData);
return layerData->mLastPaintOffset.valueOr(layerData->mTranslation);
} }
/** /**
@ -5201,7 +5212,7 @@ void ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem,
#endif #endif
InvalidatePreTransformRect( InvalidatePreTransformRect(
t, aData->mGeometry->ComputeInvalidationRegion(), aData->mClip, t, aData->mGeometry->ComputeInvalidationRegion(), aData->mClip,
mLayerBuilder->GetLastPaintOffset(t), aData->mTransform); GetLastPaintOffset(t), aData->mTransform);
} }
// Clear the old geometry so that invalidation thinks the item has been // Clear the old geometry so that invalidation thinks the item has been
// added this paint. // added this paint.
@ -5578,13 +5589,6 @@ InactiveLayerData::~InactiveLayerData() {
} }
} }
nsIntPoint FrameLayerBuilder::GetLastPaintOffset(PaintedLayer* aLayer) {
PaintedDisplayItemLayerUserData* layerData =
GetPaintedDisplayItemLayerUserData(aLayer);
MOZ_ASSERT(layerData);
return layerData->mLastPaintOffset.valueOr(layerData->mTranslation);
}
bool FrameLayerBuilder::CheckInLayerTreeCompressionMode() { bool FrameLayerBuilder::CheckInLayerTreeCompressionMode() {
if (mInLayerTreeCompressionMode) { if (mInLayerTreeCompressionMode) {
return true; return true;

Просмотреть файл

@ -622,13 +622,6 @@ class FrameLayerBuilder : public layers::LayerUserData {
typedef void (*DisplayItemDataCallback)(nsIFrame* aFrame, typedef void (*DisplayItemDataCallback)(nsIFrame* aFrame,
DisplayItemData* aItem); DisplayItemData* aItem);
/**
* Get the translation transform that was in aLayer when we last painted. It's
* either the transform saved by ~FrameLayerBuilder(), or else the transform
* that's currently in the layer (which must be an integer translation).
*/
nsIntPoint GetLastPaintOffset(PaintedLayer* aLayer);
/** /**
* Return the resolution at which we expect to render aFrame's contents, * Return the resolution at which we expect to render aFrame's contents,
* assuming they are being painted to retained layers. This takes into account * assuming they are being painted to retained layers. This takes into account