WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
91965
[chromium mac] Transforms to GraphicsContext need to be synced to CGContext on Chromium Mac
https://bugs.webkit.org/show_bug.cgi?id=91965
Summary
[chromium mac] Transforms to GraphicsContext need to be synced to CGContext o...
Keishi Hattori
Reported
2012-07-23 00:04:50 PDT
Transforms to GraphicsContext are being ignored by chromium. It's because Skia requires CGContext to be recreated to reflect the current SkCanvas state.
Attachments
Patch
(163.17 KB, patch)
2012-07-23 01:12 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(28.29 KB, patch)
2012-08-08 18:48 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Patch
(94.80 KB, patch)
2012-08-12 22:57 PDT
,
Keishi Hattori
benjamin
: review-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Keishi Hattori
Comment 1
2012-07-23 01:12:00 PDT
Created
attachment 153751
[details]
Patch
Keishi Hattori
Comment 2
2012-07-23 01:14:31 PDT
I think this needs to be fixed by either - use NSAffineTransform instead of GraphicsContext - or move the LocalCurrentGraphicsContext initializations to after the transforms
Simon Fraser (smfr)
Comment 3
2012-07-23 10:54:36 PDT
The title of this bug is overly general. Please fix it.
Keishi Hattori
Comment 4
2012-07-23 18:51:59 PDT
Changed to: Transforms to GraphicsContext need to be synced to CGContext on Chromium Mac
Keishi Hattori
Comment 5
2012-07-24 07:00:42 PDT
Could caryclark@ or eseidel@ give me feedback? I read the commends on
Bug 62213
but I can't understand why LocalCurrentGraphicsContext was implemented this way. How should this be fixed?
Cary Clark
Comment 6
2012-07-24 07:44:08 PDT
At the time I coded it, LocalCurrentGraphicsContext appeared to be a convenient place to set up the SkCanvas with the current graphics transform and clip, set up a bitmap for CoreGraphics to draw into, let CoreGraphics draw the UI element, and then at the end (in the LocalCurrentGraphicsContext destructor), draw the resulting bitmap. As you've noted, the calls through paintInfo.context->translate and so on and the calls to GraphicsContext::save() and restore() (as wrapped by GraphicsContextStateSaver) don't work as intended because they are operating on the Skia context instead of the CG Context. One possible solution would be to vector these calls to CG during the scope of the LocalCurrentGraphicsContext. That is, while an SkBitLocker is in play, changes to the graphics context and transform would be redirected to the current CoreGraphics context instead of the SkCanvas context. Does this sound like it would work?
Build Bot
Comment 7
2012-07-26 01:47:55 PDT
Comment on
attachment 153751
[details]
Patch
Attachment 153751
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/13342654
Eric Seidel (no email)
Comment 8
2012-08-07 16:20:20 PDT
LocalCurrentGraphicsContext was created solely as a way to bridge our CG-only world of WebKIt (where "graphics context" objects are passed around on the stack) into AppKit drawing methods, which operate on the "current context" -- a global static.
http://trac.webkit.org/changeset/16286
I have vague recollections of
bug 62213
and Skia adding additional functionality to LocalCurrentGraphicsContext, but you'd have to talk to Cary for more detailed design information.
Eric Seidel (no email)
Comment 9
2012-08-07 16:22:31 PDT
Before LocalCurrentGraphicsContext, we had a bunch of ugly mac-specific code for dealing with setting up/restoring the current graphics context. We can certainly move where LocalCurrentGraphicsContext is initialized if that would help, including using local blocks {} to restrict it's duration.
Keishi Hattori
Comment 10
2012-08-08 18:48:45 PDT
Created
attachment 157365
[details]
Patch
Keishi Hattori
Comment 11
2012-08-08 18:56:28 PDT
(In reply to
comment #9
)
> Before LocalCurrentGraphicsContext, we had a bunch of ugly mac-specific code for dealing with setting up/restoring the current graphics context. We can certainly move where LocalCurrentGraphicsContext is initialized if that would help, including using local blocks {} to restrict it's duration.
OK so obviously we shouldn't revert to using Mac specific code. The problem isn't that LocalCurrentGraphicsContext lives too long, but that it is initialized too early. It needs to come after the transform calls and before the draw calls. The patch I uploaded right now is an my attempt at implementing Cary's idea of syncing the transform calls to GraphicsContext to CGContext. Could you take a look and see if I am headed in the right direction?
Build Bot
Comment 12
2012-08-08 19:26:53 PDT
Comment on
attachment 157365
[details]
Patch
Attachment 157365
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/13452861
Build Bot
Comment 13
2012-08-08 21:57:40 PDT
Comment on
attachment 157365
[details]
Patch
Attachment 157365
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/13452897
Keishi Hattori
Comment 14
2012-08-12 22:57:54 PDT
Created
attachment 157922
[details]
Patch
Keishi Hattori
Comment 15
2012-08-13 06:10:37 PDT
(In reply to
comment #11
)
> (In reply to
comment #9
) > > Before LocalCurrentGraphicsContext, we had a bunch of ugly mac-specific code for dealing with setting up/restoring the current graphics context. We can certainly move where LocalCurrentGraphicsContext is initialized if that would help, including using local blocks {} to restrict it's duration. > > OK so obviously we shouldn't revert to using Mac specific code. > > The problem isn't that LocalCurrentGraphicsContext lives too long, but that it is initialized too early. It needs to come after the transform calls and before the draw calls. > > The patch I uploaded right now is an my attempt at implementing Cary's idea of syncing the transform calls to GraphicsContext to CGContext. Could you take a look and see if I am headed in the right direction?
caryclark@ could you take a look?
Cary Clark
Comment 16
2012-08-20 08:10:44 PDT
(In reply to
comment #15
)
> (In reply to
comment #11
) > > (In reply to
comment #9
) > > > Before LocalCurrentGraphicsContext, we had a bunch of ugly mac-specific code for dealing with setting up/restoring the current graphics context. We can certainly move where LocalCurrentGraphicsContext is initialized if that would help, including using local blocks {} to restrict it's duration. > > > > OK so obviously we shouldn't revert to using Mac specific code. > > > > The problem isn't that LocalCurrentGraphicsContext lives too long, but that it is initialized too early. It needs to come after the transform calls and before the draw calls. > > > > The patch I uploaded right now is an my attempt at implementing Cary's idea of syncing the transform calls to GraphicsContext to CGContext. Could you take a look and see if I am headed in the right direction? > > caryclark@ could you take a look?
My apologies for not replying sooner. I was on vacation last week. The change looks good, but is difficult to follow because of its complexity. Are there old tests that this fixes, or new tests that exercise this? I couldn't see the difference in the checked-in test images.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug