Closed Bug 1241163 Opened 4 years ago Closed 4 years ago

Replace DrawTarget::CreateSourceSurfaceFromNativeSurface(CAIRO_CONTEXT) with something cleaner

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: lsalzman, Assigned: lsalzman)

Details

Attachments

(1 file, 2 obsolete files)

DrawTarget::CreateSourceSurfaceFromNativeSurface(CAIRO_CONTEXT) is misleading in several ways:
It forces other draw targets (like DrawTargetSkia) to know how to create a SourceSurfaceCairo.
Rather than actually taking a cairo_t, it takes a cairo_surface_t.
It requires clunky use of the NativeSurface wrapper mechanism.

We already have precedent for a cleaner interface in Factory::CreateDrawTargetForCairoSurface, so let's clean this up...
Fix bracket outside of #ifdef
Attachment #8710007 - Attachment is obsolete: true
Attachment #8710007 - Flags: review?(jmuizelaar)
Attachment #8710019 - Flags: review?(jmuizelaar)
Comment on attachment 8710019 [details] [diff] [review]
replace DrawTarget::CreateSourceSurfaceFromNativeSurface(CAIRO_CONTEXT) with Factory::CreateSourceSurfaceForCairoSurface

Review of attachment 8710019 [details] [diff] [review]:
-----------------------------------------------------------------

That looks a lot better.

::: gfx/2d/Factory.cpp
@@ +862,5 @@
> +  RefPtr<SourceSurface> retVal;
> +#ifdef USE_CAIRO
> +  retVal = new SourceSurfaceCairo(aSurface, aSize, aFormat);
> +#endif
> +  return retVal.forget();

The following is clearer to me:
#ifdef USE_CAIRO
return MakeAndAddRef<SourceSurfaceCairo>(aSurface, aSize, aFormat);
#else
return nullptr;
#endif
Attachment #8710019 - Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/417708054b36
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.