mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 14:25:49 +00:00
Bug 1494836. Replace NormalizedRect for visible area. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D7189
This commit is contained in:
parent
405b9a03c5
commit
d7cb9ac2ef
@ -139,7 +139,7 @@ struct OpUpdateBlobImage {
|
||||
};
|
||||
|
||||
struct OpSetImageVisibleArea {
|
||||
Rect area;
|
||||
ImageIntRect area;
|
||||
ImageKey key;
|
||||
};
|
||||
|
||||
|
@ -328,7 +328,8 @@ IpcResourceUpdateQueue::UpdateExternalImage(wr::ExternalImageId aExtId,
|
||||
}
|
||||
|
||||
void
|
||||
IpcResourceUpdateQueue::SetImageVisibleArea(ImageKey aKey, const gfx::Rect& aArea)
|
||||
IpcResourceUpdateQueue::SetImageVisibleArea(ImageKey aKey,
|
||||
const ImageIntRect& aArea)
|
||||
{
|
||||
mUpdates.AppendElement(layers::OpSetImageVisibleArea(aArea, aKey));
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
ImageKey aKey,
|
||||
ImageIntRect aDirtyRect);
|
||||
|
||||
void SetImageVisibleArea(ImageKey aKey, const gfx::Rect& aArea);
|
||||
void SetImageVisibleArea(ImageKey aKey, const ImageIntRect& aArea);
|
||||
|
||||
void DeleteImage(wr::ImageKey aKey);
|
||||
|
||||
|
@ -343,7 +343,7 @@ WebRenderBridgeParent::UpdateResources(const nsTArray<OpUpdateResource>& aResour
|
||||
}
|
||||
case OpUpdateResource::TOpSetImageVisibleArea: {
|
||||
const auto& op = cmd.get_OpSetImageVisibleArea();
|
||||
wr::NormalizedRect area;
|
||||
wr::DeviceUintRect area;
|
||||
area.origin.x = op.area().x;
|
||||
area.origin.y = op.area().y;
|
||||
area.size.width = op.area().width;
|
||||
|
@ -63,23 +63,6 @@ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR(BlobGroupDataProperty,
|
||||
nsTArray<BlobItemData*>,
|
||||
DestroyBlobGroupDataProperty);
|
||||
|
||||
static void
|
||||
SetBlobImageVisibleArea(wr::IpcResourceUpdateQueue& aResources,
|
||||
wr::ImageKey aImageKey,
|
||||
const LayoutDeviceRect& aImageRect,
|
||||
const LayoutDeviceRect& aPaintRect)
|
||||
{
|
||||
LayoutDeviceRect visibleRect = aImageRect.Intersect(aPaintRect);
|
||||
// Send the visible rect in normalized coordinates.
|
||||
Rect visibleArea = Rect((visibleRect.x - aImageRect.x) / aImageRect.width,
|
||||
(visibleRect.y - aImageRect.y) / aImageRect.height,
|
||||
visibleRect.width / aImageRect.width,
|
||||
visibleRect.height / aImageRect.height);
|
||||
|
||||
aResources.SetImageVisibleArea(aImageKey, visibleArea);
|
||||
}
|
||||
|
||||
|
||||
// These are currently manually allocated and ownership is help by the mDisplayItems
|
||||
// hash table in DIGroup
|
||||
struct BlobItemData
|
||||
@ -348,7 +331,7 @@ struct DIGroup
|
||||
nsPoint mLastAnimatedGeometryRootOrigin;
|
||||
IntRect mInvalidRect;
|
||||
nsRect mGroupBounds;
|
||||
LayoutDeviceRect mPaintRect;
|
||||
LayerIntRect mPaintRect;
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
gfx::Size mScale;
|
||||
FrameMetrics::ViewID mScrollId;
|
||||
@ -631,7 +614,9 @@ struct DIGroup
|
||||
GP("Not repainting group because it's empty\n");
|
||||
GP("End EndGroup\n");
|
||||
if (mKey) {
|
||||
SetBlobImageVisibleArea(aResources, mKey.value(), bounds, mPaintRect);
|
||||
aResources.SetImageVisibleArea(
|
||||
mKey.value(),
|
||||
ViewAs<ImagePixel>(mPaintRect, PixelCastJustification::LayerIsImage));
|
||||
PushImage(aBuilder, bounds);
|
||||
}
|
||||
return;
|
||||
@ -703,7 +688,9 @@ struct DIGroup
|
||||
}
|
||||
mFonts = std::move(fonts);
|
||||
mInvalidRect.SetEmpty();
|
||||
SetBlobImageVisibleArea(aResources, mKey.value(), mPaintRect, bounds);
|
||||
aResources.SetImageVisibleArea(
|
||||
mKey.value(),
|
||||
ViewAs<ImagePixel>(mPaintRect, PixelCastJustification::LayerIsImage));
|
||||
PushImage(aBuilder, bounds);
|
||||
GP("End EndGroup\n\n");
|
||||
}
|
||||
@ -1232,16 +1219,23 @@ WebRenderCommandBuilder::DoGroupingForDisplayList(nsDisplayList* aList,
|
||||
g.mAppUnitsPerDevPixel = appUnitsPerDevPixel;
|
||||
group.mResidualOffset = residualOffset;
|
||||
group.mGroupBounds = groupBounds;
|
||||
group.mPaintRect = LayoutDeviceRect::FromAppUnits(
|
||||
aWrappingItem->GetPaintRect(),
|
||||
appUnitsPerDevPixel
|
||||
);
|
||||
group.mAppUnitsPerDevPixel = appUnitsPerDevPixel;
|
||||
group.mLayerBounds = LayerIntRect::FromUnknownRect(ScaleToOutsidePixelsOffset(group.mGroupBounds,
|
||||
scale.width,
|
||||
scale.height,
|
||||
group.mAppUnitsPerDevPixel,
|
||||
residualOffset));
|
||||
group.mPaintRect = LayerIntRect::FromUnknownRect(
|
||||
ScaleToOutsidePixelsOffset(aWrappingItem->GetPaintRect(),
|
||||
scale.width,
|
||||
scale.height,
|
||||
group.mAppUnitsPerDevPixel,
|
||||
residualOffset))
|
||||
.Intersect(group.mLayerBounds);
|
||||
// XXX: Make the paint rect relative to the layer bounds. After we include
|
||||
// mLayerBounds.TopLeft() in the blob image we want to stop doing this
|
||||
// adjustment.
|
||||
group.mPaintRect = group.mPaintRect - group.mLayerBounds.TopLeft();
|
||||
g.mTransform = Matrix::Scaling(scale.width, scale.height)
|
||||
.PostTranslate(residualOffset.x, residualOffset.y);
|
||||
group.mScale = scale;
|
||||
|
@ -702,7 +702,9 @@ TransactionBuilder::UpdateExternalImageWithDirtyRect(ImageKey aKey,
|
||||
aDirtyRect);
|
||||
}
|
||||
|
||||
void TransactionBuilder::SetImageVisibleArea(ImageKey aKey, const wr::NormalizedRect& aArea)
|
||||
void
|
||||
TransactionBuilder::SetImageVisibleArea(ImageKey aKey,
|
||||
const wr::DeviceUintRect& aArea)
|
||||
{
|
||||
wr_resource_updates_set_image_visible_area(mTxn, aKey, &aArea);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
const wr::DeviceUintRect& aDirtyRect,
|
||||
uint8_t aChannelIndex = 0);
|
||||
|
||||
void SetImageVisibleArea(ImageKey aKey, const wr::NormalizedRect& aArea);
|
||||
void SetImageVisibleArea(ImageKey aKey, const wr::DeviceUintRect& aArea);
|
||||
|
||||
void DeleteImage(wr::ImageKey aKey);
|
||||
|
||||
|
@ -1359,7 +1359,7 @@ pub extern "C" fn wr_resource_updates_update_image(
|
||||
pub extern "C" fn wr_resource_updates_set_image_visible_area(
|
||||
txn: &mut Transaction,
|
||||
key: WrImageKey,
|
||||
area: &NormalizedRect,
|
||||
area: &DeviceUintRect,
|
||||
) {
|
||||
txn.set_image_visible_area(key, *area);
|
||||
}
|
||||
|
@ -21,14 +21,16 @@ namespace mozilla {
|
||||
// Feel free to add more justifications to PixelCastJustification, along with
|
||||
// a comment that explains under what circumstances it is appropriate to use.
|
||||
|
||||
enum class PixelCastJustification : uint8_t {
|
||||
enum class PixelCastJustification : uint8_t
|
||||
{
|
||||
// For the root layer, Screen Pixel = Parent Layer Pixel.
|
||||
ScreenIsParentLayerForRoot,
|
||||
// On the layout side, Screen Pixel = LayoutDevice at the outer-window level.
|
||||
LayoutDeviceIsScreenForBounds,
|
||||
// For the root layer, Render Target Pixel = Parent Layer Pixel.
|
||||
RenderTargetIsParentLayerForRoot,
|
||||
// For the root composition size we want to view it as layer pixels in any layer
|
||||
// For the root composition size we want to view it as layer pixels in any
|
||||
// layer
|
||||
ParentLayerToLayerForRootComposition,
|
||||
// The Layer coordinate space for one layer is the ParentLayer coordinate
|
||||
// space for its children
|
||||
@ -55,7 +57,9 @@ enum class PixelCastJustification : uint8_t {
|
||||
MultipleAsyncTransforms,
|
||||
// We have reason to believe a layer doesn't have a local transform.
|
||||
// Should only be used if we've already checked or asserted this.
|
||||
NoTransformOnLayer
|
||||
NoTransformOnLayer,
|
||||
// LayerPixels are ImagePixels
|
||||
LayerIsImage,
|
||||
};
|
||||
|
||||
template <class TargetUnits, class SourceUnits>
|
||||
|
Loading…
x
Reference in New Issue
Block a user