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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 4 13:42:47 PST 2013


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





--- Comment #14 from Aloisio Almeida Jr <aloisio.almeida at openbossa.org>  2013-12-04 13:41:05 PST ---
(In reply to comment #10)
> (From update of attachment 216982 [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.

I will remove the subsurface variable and use:

patternSurface = cairo_surface_create_for_rectangle(surface, expandedSrcRect.x(), expandedSrcRect.y(), expandedSrcRect.width(), expandedSrcRect.height());

-- 
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