[Webkit-unassigned] [Bug 124209] [Cairo] Avoid extra copy when drawing images

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 4 23:33:11 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=124209





--- Comment #16 from Carlos Garcia Campos <cgarcia at igalia.com>  2013-12-04 23:31:28 PST ---
(In reply to comment #14)
> (In reply to comment #10)
> > (From update of attachment 216982 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=216982&action=review
> > 
> > > Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp:176
> > > +    RefPtr<cairo_surface_t> subsurface;
> > 
> > This doesn't seem to be used outside the if context, I think it could be moved to the if block.
> > 
> > > Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp:179
> > > +    if (srcRect.x() || srcRect.y() || srcRect.size() == cairoSurfaceSize(surface)) {
> > 
> > If I understood correctly the commit message, you want to use a subsurface when source size is different to surface size, right?
> > 
> > > Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp:187
> > > +        subsurface = adoptRef(cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(),
> > > +            expandedSrcRect.y(), expandedSrcRect.width(), expandedSrcRect.height()));
> > > +        patternSurface = subsurface.get();
> > 
> > Maybe you don't even need to subsurface variable if you use a single lines here:
> > 
> > patternSurface = adoptRef(cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(), expandedSrcRect.y(), expandedSrcRect.width(), expandedSrcRect.height()));
> 
> 
> The pattern will hold the subsurface reference. The subsurface will be destroyed together with the pattern. So, I don't need to hold the subsurface reference as a RefPtr.

No, the pattern doesn't adopt the surface reference, but increases it.

> I will remove the subsurface variable and use:
> 
> patternSurface = cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(), expandedSrcRect.y(), expandedSrcRect.width(), expandedSrcRect.height());

That leaks the surface, when the pattern is destroyed the surface ref counter will still be 1

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list