Bug 179598 - [Cairo] Move state stack, CTM, transparency layer operations in GraphicsContextCairo to CairoOperations
Summary: [Cairo] Move state stack, CTM, transparency layer operations in GraphicsConte...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-12 11:03 PST by Zan Dobersek
Modified: 2017-11-15 09:33 PST (History)
4 users (show)

See Also:


Attachments
Patch (7.63 KB, patch)
2017-11-12 11:06 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (7.94 KB, patch)
2017-11-12 23:37 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2017-11-12 11:03:51 PST
[Cairo] Move state stack, CTM, transparency layer operations in GraphicsContextCairo to CairoOperations
Comment 1 Zan Dobersek 2017-11-12 11:06:44 PST
Created attachment 326721 [details]
Patch
Comment 2 Carlos Garcia Campos 2017-11-12 22:35:58 PST
Comment on attachment 326721 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=326721&action=review

> Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:56
> +void save(PlatformContextCairo& platformContext)
> +{
> +    platformContext.save();
> +}
> +
> +void restore(PlatformContextCairo& platformContext)
> +{
> +    platformContext.restore();
> +}

What's the point of these? They don't use cairo directly, I guess caller could call save restore on platform context, no? Just consistency?

> Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:90
> +    cairo_paint_with_alpha(cr, platformContext.layers().last());
> +    platformContext.layers().removeLast();

We could use takeLast() here.
Comment 3 Zan Dobersek 2017-11-12 23:28:31 PST
Comment on attachment 326721 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=326721&action=review

>> Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:56
>> +}
> 
> What's the point of these? They don't use cairo directly, I guess caller could call save restore on platform context, no? Just consistency?

Yes, it's for consistency. But essentially we don't need to know about the PlatformContextCairo save() and restore() methods in the GraphicsContextCairo file, we can just pass the memory address of the given PlatformContextCairo object and isolate the PlatformContextCairo operations in CairoOperations file.

In theory this is a clear-cut approach that basically isolates PlatformContextCairo usage to a single .cpp file, but this doesn't really apply anymore with the unified builds since different .cpp files are now pulled into a single source file compilation. I think it's still possible to exclude specific build targets from the unified build, that might be useful.
Comment 4 Zan Dobersek 2017-11-12 23:37:06 PST
Created attachment 326747 [details]
Patch for landing
Comment 5 Zan Dobersek 2017-11-12 23:37:47 PST
Comment on attachment 326747 [details]
Patch for landing

Clearing flags on attachment: 326747

Committed r224744: <https://trac.webkit.org/changeset/224744>
Comment 6 Zan Dobersek 2017-11-12 23:37:51 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2017-11-15 09:33:40 PST
<rdar://problem/35561948>