Closed Bug 1062723 Opened 10 years ago Closed 10 years ago

Add source clipping to Moz2D SurfacePattern

Categories

(Core :: Graphics, defect)

29 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

(Depends on 1 open bug)

Details

Attachments

(6 files, 9 obsolete files)

(deleted), patch
mattwoodrow
: review+
Details | Diff | Splinter Review
(deleted), patch
jrmuizel
: review+
Details | Diff | Splinter Review
(deleted), patch
gw280
: review+
Details | Diff | Splinter Review
(deleted), patch
bas.schouten
: review+
Details | Diff | Splinter Review
(deleted), patch
bas.schouten
: review+
Details | Diff | Splinter Review
(deleted), patch
bas.schouten
: review+
Details | Diff | Splinter Review
Attached patch moz2d-subimage (obsolete) (deleted) — Splinter Review
We want to use direct2d 1.1's source clipping where we currently use CreateSamplingRestrictedDrawable. Since this call path ends up with a FillRect call, we need to be able to specify the source clipping rectangle within SurfacePattern. How does this look for the API Bas?
Attachment #8483978 - Flags: review?(bas)
Attachment #8487632 - Flags: review?(bas)
Comment on attachment 8483978 [details] [diff] [review] moz2d-subimage Review of attachment 8483978 [details] [diff] [review]: ----------------------------------------------------------------- Personally I'd say make it an intrect :) Sampling from half pixels is rather arbitrary (and hard to support for some backends) I'd say, even if D2D seems to 'support' it :). Other than that it looks good! ::: gfx/2d/2D.h @@ +290,5 @@ > Matrix mMatrix; //!< Transforms the pattern into user space > + > + Rect mSamplingRect; /**< Rect that must not be sampled outside of, > + or an empty rect if none has been specified. */ > + nit: Whitespace
Attachment #8483978 - Flags: review?(bas) → review+
(In reply to Bas Schouten (:bas.schouten) from comment #6) > Comment on attachment 8483978 [details] [diff] [review] > moz2d-subimage > > Review of attachment 8483978 [details] [diff] [review]: > ----------------------------------------------------------------- > > Personally I'd say make it an intrect :) Sampling from half pixels is rather > arbitrary (and hard to support for some backends) I'd say, even if D2D seems > to 'support' it :). Other than that it looks good! Yeah, probably a good idea. Quartz and D2D take a float rect, the rest take ints. I was thinking that they were identical, but I guess that's not true for extend modes that aren't CLAMP.
Attachment #8483978 - Attachment is obsolete: true
Attachment #8487710 - Flags: review+
Attachment #8487711 - Flags: review?(bas)
Attachment #8487632 - Attachment is obsolete: true
Attachment #8487632 - Flags: review?(bas)
Attachment #8487633 - Attachment is obsolete: true
Attachment #8487712 - Flags: review?(jmuizelaar)
Attachment #8487713 - Flags: review?(gwright)
Attachment #8487634 - Attachment is obsolete: true
Attachment #8487635 - Attachment is obsolete: true
Attachment #8487714 - Flags: review?(bas)
Attachment #8487636 - Attachment is obsolete: true
Attachment #8487715 - Flags: review?(bas)
Attachment #8487712 - Flags: review?(jmuizelaar) → review+
Comment on attachment 8487711 [details] [diff] [review] Part 2: Implement source clipping for DrawTargetCairo Review of attachment 8487711 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetCairo.cpp @@ +175,5 @@ > cairo_surface_mark_dirty(surf); > return surf; > } > > +cairo_surface_t* GetAsImageSurface(cairo_surface_t* aSurface) nit: Document that this function never adds a reference, it's very relevant later on in this patch. @@ +265,3 @@ > if (aSurface->GetType() == SurfaceType::CAIRO) { > cairo_surface_t* surf = static_cast<SourceSurfaceCairo*>(aSurface)->GetSurface(); > cairo_surface_reference(surf); Hrm, I'd find this more readable(and less of a footgun) if we did one of two things: 1. Only do this ref inside an else clause below. 2. Call ExtractSubImage unconditionally, and have it add a reference and return aSurface if the subimage != surfacerect What do you think?
Comment on attachment 8487714 [details] [diff] [review] Part 5: Implement source clipping for DrawTargetD2D Review of attachment 8487714 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetD2D.cpp @@ +2367,5 @@ > + IntRect samplingRect = pat->mSamplingRect; > + > + RefPtr<DrawTargetD2D> dt = new DrawTargetD2D(); > + if (!dt->Init(samplingRect.Size(), > + source->GetFormat())) { MOZ_ASSERT here, this suggests the samplingRect was bigger than the max texture size and we want anyone debugging an issue to be swiftly made aware of that :)
Attachment #8487714 - Flags: review?(bas) → review+
Attachment #8487715 - Flags: review?(bas) → review+
You're right, that reference add/release around ExtractSubImage was really weird.
Attachment #8487711 - Attachment is obsolete: true
Attachment #8487711 - Flags: review?(bas)
Attachment #8488437 - Flags: review?(bas)
Attachment #8488437 - Attachment is obsolete: true
Attachment #8488437 - Flags: review?(bas)
Attachment #8488451 - Flags: review?(bas)
Attachment #8488451 - Attachment is obsolete: true
Attachment #8488451 - Flags: review?(bas)
Attachment #8488452 - Flags: review?(bas)
Attachment #8488452 - Flags: review?(bas) → review+
Comment on attachment 8487713 [details] [diff] [review] Part 4: Implement source clipping for DrawTargetSkia Review of attachment 8487713 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/2d/DrawTargetSkia.cpp @@ +812,5 @@ > > #endif > > void > +DrawTargetSkia::Init(unsigned char* aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat){ Accident?
Attachment #8487713 - Flags: review?(gwright) → review+
(In reply to George Wright (:gw280) from comment #19) > Comment on attachment 8487713 [details] [diff] [review] > Part 4: Implement source clipping for DrawTargetSkia > > Review of attachment 8487713 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: gfx/2d/DrawTargetSkia.cpp > @@ +812,5 @@ > > > > #endif > > > > void > > +DrawTargetSkia::Init(unsigned char* aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat){ > > Accident? Correct, will fix.
This caused a bunch of performance regressions as far as I can tell (SVG-ASAP, Tab animation, customization animations, Tp5 scroll Tresize, Tp5 Optimized, Tp5 Optimized (XRes), etc). Is that expected?
Flags: needinfo?(matt.woodrow)
Flags: needinfo?(bas)
(In reply to Boris Zbarsky [:bz] from comment #22) > This caused a bunch of performance regressions as far as I can tell > (SVG-ASAP, Tab animation, customization animations, Tp5 scroll Tresize, Tp5 > Optimized, Tp5 Optimized (XRes), etc). Is that expected? No, it's expected to cause improvements! Matt's on PTO, and I know little about the layout side implementation, so let's back it out.
Flags: needinfo?(bas)
Depends on: 1067588
Depends on: 1075467
No longer depends on: 1075467
Depends on: 1077434
Flags: needinfo?(matt.woodrow)
Depends on: 1147229
Depends on: 1157542
No longer depends on: 1157542
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: