Bug 1522310. Use GetRect() instead of IntRect(IntPoint(), GetSize()) in Filters code. r=mstange

This is needed so that we can use SourceSurfaces that don't have a
implicit 0,0 origin like those that would come from a DrawTargetTiled
or DrawTargetOffset.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Muizelaar 2019-01-25 23:03:16 +00:00
Родитель aaa0feb2a4
Коммит b0d9cc5e6d
3 изменённых файлов: 10 добавлений и 3 удалений

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

@ -343,6 +343,8 @@ class SourceSurface : public external::AtomicRefCounted<SourceSurface> {
virtual SurfaceType GetType() const = 0;
virtual IntSize GetSize() const = 0;
/* GetRect is useful for when the underlying surface doesn't actually
* have a backing store starting at 0, 0. e.g. SourceSurfaceOffset */
virtual IntRect GetRect() const { return IntRect(IntPoint(0, 0), GetSize()); }
virtual SurfaceFormat GetFormat() const = 0;

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

@ -279,6 +279,10 @@ size_t BufferSizeFromDimensions(int32_t aWidth, int32_t aHeight, int32_t aDepth,
/**
* aSrcRect: Rect relative to the aSrc surface
* aDestPoint: Point inside aDest surface
*
* aSrcRect and aDestPoint are in internal local coordinates.
* i.e. locations of pixels and not in the same coordinate space
* as aSrc->GetRect()
*/
bool CopyRect(DataSourceSurface* aSrc, DataSourceSurface* aDest,
IntRect aSrcRect, IntPoint aDestPoint) {

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

@ -402,6 +402,8 @@ static already_AddRefed<DataSourceSurface> GetDataSurfaceInRect(
}
IntRect intersect = sourceRect.Intersect(aDestRect);
// create rects that are in surface local space.
IntRect intersectInSourceSpace = intersect - sourceRect.TopLeft();
IntRect intersectInDestSpace = intersect - aDestRect.TopLeft();
SurfaceFormat format =
@ -726,7 +728,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(
#ifdef DEBUG_DUMP_SURFACES
printf("input from input surface:\n");
#endif
surfaceRect = IntRect(IntPoint(0, 0), surface->GetSize());
surfaceRect = surface->GetRect();
} else {
// Input from input filter
#ifdef DEBUG_DUMP_SURFACES
@ -829,8 +831,7 @@ IntRect FilterNodeSoftware::GetInputRectInRect(uint32_t aInputEnumIndex,
return IntRect();
}
if (mInputSurfaces[inputIndex]) {
return aInRect.Intersect(
IntRect(IntPoint(0, 0), mInputSurfaces[inputIndex]->GetSize()));
return aInRect.Intersect(mInputSurfaces[inputIndex]->GetRect());
}
RefPtr<FilterNodeSoftware> filter = mInputFilters[inputIndex];
MOZ_ASSERT(filter, "missing input");