RESOLVED FIXED Bug 147242
[Win] Support High DPI drawing with CACFLayers
https://bugs.webkit.org/show_bug.cgi?id=147242
Summary [Win] Support High DPI drawing with CACFLayers
Brent Fulgham
Reported 2015-07-23 16:11:13 PDT
This is a follow-up to Bug 146335, which added support for High DPI use in our non-accelerated drawing paths. The Windows platform doesn't allow a single device scaling factor to be applied to individual windows. Instead, high DPI state is handled by working with larger pixel surfaces at higher DPIs, and performing scaling calculations to control widget size, positioning, etc. Yuck! This patch applies the proper scaling at various phases of our CACFLayer sizing and positioning.
Attachments
Patch (2.96 KB, patch)
2015-11-20 11:49 PST, Brent Fulgham
no flags
Patch v2 (Ignore) (2.63 KB, patch)
2015-11-20 13:26 PST, Brent Fulgham
no flags
Patch (2.03 KB, patch)
2015-11-20 13:30 PST, Brent Fulgham
simon.fraser: review+
Brent Fulgham
Comment 1 2015-07-23 16:12:10 PDT
Note: Just like with Bug 146335, these scaling calculations are all done at 1x, unless the WebKit client opts into a high DPI state. Currently, testing is just to make sure no regressions to existing 1x drawing on Windows (and all drawing on other platforms) are not affected.
Brent Fulgham
Comment 2 2015-11-20 11:49:50 PST
Tim Horton
Comment 3 2015-11-20 12:11:06 PST
Comment on attachment 265975 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=265975&action=review > Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:128 > + CACFLayerSetContentsScale(layer->platformLayer(), scaleFactor); Does the base layer actually have contents? Why do we have to set contentsScale?
Simon Fraser (smfr)
Comment 4 2015-11-20 12:11:40 PST
Comment on attachment 265975 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=265975&action=review > Source/WebCore/ChangeLog:15 > + operations are don properly. don > Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:230 > +#if HAVE(CACFLAYER_SETCONTENTSSCALE) > + float scaleFactor = CACFLayerGetContentsScale(owner()->platformLayer()); > + CACFLayerSetContentsScale(layer.platformLayer(), scaleFactor); > +#endif This is confusing; I'm not sure how owner()->platformLayer() and layer.platformLayer() are different. Why isn't this handled via GraphicsLayerCA::deviceOrPageScaleFactorChanged() as it is for other platforms?
Brent Fulgham
Comment 5 2015-11-20 12:32:27 PST
Comment on attachment 265975 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=265975&action=review >> Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:230 >> +#endif > > This is confusing; I'm not sure how owner()->platformLayer() and layer.platformLayer() are different. > > Why isn't this handled via GraphicsLayerCA::deviceOrPageScaleFactorChanged() as it is for other platforms? Hmmmmm. I'll investigate before moving forward.
Brent Fulgham
Comment 6 2015-11-20 13:26:07 PST
(In reply to comment #3) > Comment on attachment 265975 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265975&action=review > > > Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:128 > > + CACFLayerSetContentsScale(layer->platformLayer(), scaleFactor); > > Does the base layer actually have contents? Why do we have to set > contentsScale? According to the CA engineer who did the Windows work, this is needed for some arcane Windows-related reason.
Brent Fulgham
Comment 7 2015-11-20 13:26:58 PST
Created attachment 265987 [details] Patch v2 (Ignore)
Brent Fulgham
Comment 8 2015-11-20 13:28:11 PST
(In reply to comment #5) > Comment on attachment 265975 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265975&action=review > > >> Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:230 > >> +#endif > > > > This is confusing; I'm not sure how owner()->platformLayer() and layer.platformLayer() are different. > > > > Why isn't this handled via GraphicsLayerCA::deviceOrPageScaleFactorChanged() as it is for other platforms? > > Hmmmmm. I'll investigate before moving forward. It looks like this isn't needed. In fact, I wasn't even being consistent, as the other places where CACFLayerInsertSublayer was being called did not have the scaling factor change included.
Brent Fulgham
Comment 9 2015-11-20 13:30:11 PST
Brent Fulgham
Comment 10 2015-11-20 14:35:03 PST
Note You need to log in before you can comment on or make changes to this bug.