WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
150146
Host GraphicsContext's CTM inside GraphicsContextState
https://bugs.webkit.org/show_bug.cgi?id=150146
Summary
Host GraphicsContext's CTM inside GraphicsContextState
Myles C. Maxfield
Reported
2015-10-14 15:20:11 PDT
Host GraphicsContext's CTM inside GraphicsContextState
Attachments
Patch
(10.11 KB, patch)
2015-10-14 15:24 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews103 for mac-mavericks
(861.35 KB, application/zip)
2015-10-14 15:50 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews105 for mac-mavericks-wk2
(899.28 KB, application/zip)
2015-10-14 16:03 PDT
,
Build Bot
no flags
Details
Patch
(26.79 KB, patch)
2015-10-15 20:02 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(26.59 KB, patch)
2015-10-16 09:29 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(27.51 KB, patch)
2015-10-16 12:12 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(27.39 KB, patch)
2015-10-16 13:14 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(27.52 KB, patch)
2015-10-16 13:26 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(28.58 KB, patch)
2015-10-17 10:26 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(25.99 KB, patch)
2015-10-17 11:21 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(26.02 KB, patch)
2015-10-17 12:13 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch for committing
(26.83 KB, patch)
2015-10-18 12:39 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(31.01 KB, patch)
2015-10-19 17:34 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Show Obsolete
(12)
View All
Add attachment
proposed patch, testcase, etc.
Myles C. Maxfield
Comment 1
2015-10-14 15:24:02 PDT
Created
attachment 263115
[details]
Patch
Build Bot
Comment 2
2015-10-14 15:50:42 PDT
Comment on
attachment 263115
[details]
Patch
Attachment 263115
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/288285
New failing tests: fast/canvas/canvas-composite-image.html fast/canvas/canvas-composite-canvas.html
Build Bot
Comment 3
2015-10-14 15:50:46 PDT
Created
attachment 263118
[details]
Archive of layout-test-results from ews103 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 4
2015-10-14 16:03:03 PDT
Comment on
attachment 263115
[details]
Patch
Attachment 263115
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/288310
New failing tests: fast/canvas/canvas-composite-image.html fast/canvas/canvas-composite-canvas.html
Build Bot
Comment 5
2015-10-14 16:03:07 PDT
Created
attachment 263120
[details]
Archive of layout-test-results from ews105 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Myles C. Maxfield
Comment 6
2015-10-14 16:51:52 PDT
Comment on
attachment 263115
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263115&action=review
> Source/WebCore/ChangeLog:3 > + Host GraphicsContext's CTM inside GraphicsContextState
It looks like this patch is quite inadequate. GraphicsContext::applyDeviceScaleFactor(() GraphicsContext::platformApplyDeviceScaleFactor() GraphicsContext::rotate() GraphicsContext::scale() GraphicsContext::translate()
Myles C. Maxfield
Comment 7
2015-10-14 17:35:54 PDT
Comment on
attachment 263115
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263115&action=review
>> Source/WebCore/ChangeLog:3 >> + Host GraphicsContext's CTM inside GraphicsContextState > > It looks like this patch is quite inadequate. > > GraphicsContext::applyDeviceScaleFactor(() > GraphicsContext::platformApplyDeviceScaleFactor() > GraphicsContext::rotate() > GraphicsContext::scale() > GraphicsContext::translate()
While we're doing this, let's get rid of wkSetBaseCTM().
Myles C. Maxfield
Comment 8
2015-10-15 20:02:45 PDT
Created
attachment 263241
[details]
Patch
Myles C. Maxfield
Comment 9
2015-10-16 09:29:59 PDT
Created
attachment 263274
[details]
Patch
Myles C. Maxfield
Comment 10
2015-10-16 12:11:25 PDT
I should make sure all these edits to callers are necessary.
Myles C. Maxfield
Comment 11
2015-10-16 12:12:10 PDT
Created
attachment 263308
[details]
Patch
Myles C. Maxfield
Comment 12
2015-10-16 13:14:01 PDT
Created
attachment 263314
[details]
Patch
Myles C. Maxfield
Comment 13
2015-10-16 13:26:54 PDT
Created
attachment 263316
[details]
Patch
Myles C. Maxfield
Comment 14
2015-10-17 10:26:35 PDT
Created
attachment 263375
[details]
Patch
Myles C. Maxfield
Comment 15
2015-10-17 11:21:39 PDT
Created
attachment 263376
[details]
Patch
Myles C. Maxfield
Comment 16
2015-10-17 12:13:05 PDT
Created
attachment 263382
[details]
Patch
Myles C. Maxfield
Comment 17
2015-10-17 12:28:28 PDT
mrobinson: gyuyoung: do you think you could give this a port-specific review? There are some places where the EFL / GTK ports may need to be update, that I haven't found yet. Thanks!
Simon Fraser (smfr)
Comment 18
2015-10-17 13:06:14 PDT
Comment on
attachment 263382
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263382&action=review
> Source/WebCore/platform/graphics/GraphicsContext.cpp:202 > +AffineTransform GraphicsContext::getCTM(IncludeDeviceScale includeScale) const > +{ > + if (paintingDisabled()) > + return AffineTransform(); > + > + AffineTransform result; > + if (includeScale == DefinitelyIncludeDeviceScale) > + result = m_state.userToDeviceSpaceCTM * m_state.ctm; > + else > + result = m_state.ctm; > + > + return result; > +}
I think this should assert that m_state.ctm is approx. equal to the platform CTM (if there's a platformContext).
> Source/WebCore/platform/graphics/GraphicsContext.h:160 > + AffineTransform userToDeviceSpaceCTM; > + AffineTransform ctm;
These are quite big. Can we use unique_ptr and only allocate when necessary?
> Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:199 > + m_state.ctm = getPlatformCTM();
This is confusing. What if we have no platform context to get the CTM from?
> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:111 > + m_state.userToDeviceSpaceCTM = static_cast<AffineTransform>(CGContextGetUserSpaceToDeviceSpaceTransform(platformContext())) * m_state.ctm.inverse();
Why does windows have the inverse?
Myles C. Maxfield
Comment 19
2015-10-18 12:25:01 PDT
Comment on
attachment 263382
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263382&action=review
>> Source/WebCore/platform/graphics/GraphicsContext.h:160 >> + AffineTransform ctm; > > These are quite big. Can we use unique_ptr and only allocate when necessary?
In my testing, I've found that these matrices are almost never the identity, which means we would immediately be allocating them and keeping them around. Given that we'd be paying the memory cost anyway, but with an additional allocation hit, I don't think this is a good idea.
>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:111 >> + m_state.userToDeviceSpaceCTM = static_cast<AffineTransform>(CGContextGetUserSpaceToDeviceSpaceTransform(platformContext())) * m_state.ctm.inverse(); > > Why does windows have the inverse?
CGContextGetDefaultUserSpaceToDeviceSpaceTransform() doesn't exist on Windows, but CGContextGetUserSpaceToDeviceSpaceTransform() does.
Myles C. Maxfield
Comment 20
2015-10-18 12:34:58 PDT
Comment on
attachment 263382
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=263382&action=review
>>> Source/WebCore/platform/graphics/GraphicsContext.h:160 >>> + AffineTransform ctm; >> >> These are quite big. Can we use unique_ptr and only allocate when necessary? > > In my testing, I've found that these matrices are almost never the identity, which means we would immediately be allocating them and keeping them around. Given that we'd be paying the memory cost anyway, but with an additional allocation hit, I don't think this is a good idea.
The transform is the identity 0.4% of the time (based on running layout tests)
Myles C. Maxfield
Comment 21
2015-10-18 12:39:25 PDT
Created
attachment 263426
[details]
Patch for committing
Martin Robinson
Comment 22
2015-10-18 23:09:52 PDT
Comment on
attachment 263426
[details]
Patch for committing The Cairo changes look fine to me.
Myles C. Maxfield
Comment 23
2015-10-19 10:28:43 PDT
Given Martin's consideration of the Cairo changes, and that EWS is all green (excepting bot problems), I'm going to land this.
Myles C. Maxfield
Comment 24
2015-10-19 10:29:22 PDT
Committed
r191295
: <
http://trac.webkit.org/changeset/191295
>
Ryan Haddad
Comment 25
2015-10-19 12:21:00 PDT
This change causes the following tests to crash in debug builds: canvas/philip/tests/2d.transformation.rotate.wrap.html canvas/philip/tests/2d.transformation.rotate.wrapnegative.html imported/w3c/canvas/2d.transformation.rotate.wrap.html mported/w3c/canvas/2d.transformation.rotate.wrapnegative.html <
https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK2%20(Tests)/r191295%20(457)/results.html
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.JavaScriptCore 0x000000010d4c4307 WTFCrash + 39 (Assertions.cpp:321) 1 com.apple.WebCore 0x000000010f9d8624 WebCore::GraphicsContext::getCTM(WebCore::GraphicsContext::IncludeDeviceScale) const + 324 (GraphicsContext.cpp:221) 2 com.apple.WebCore 0x000000010f9dafbf WebCore::GraphicsContext::checkCTMInvariants() const + 47 (GraphicsContext.h:436) 3 com.apple.WebCore 0x000000010f9d83c1 WebCore::GraphicsContext::rotate(float) + 129 (GraphicsContext.cpp:182) 4 com.apple.WebCore 0x000000010f1f7d3c WebCore::CanvasRenderingContext2D::rotate(float) + 508 (CanvasRenderingContext2D.cpp:720) 5 com.apple.WebCore 0x000000010febdd7b WebCore::jsCanvasRenderingContext2DPrototypeFunctionRotate(JSC::ExecState*) + 571 (JSCanvasRenderingContext2D.cpp:1195) 6 ??? 0x00002b2c3ac01028 0 + 47468964220968
Myles C. Maxfield
Comment 26
2015-10-19 17:34:25 PDT
Created
attachment 263536
[details]
Patch
Myles C. Maxfield
Comment 27
2015-10-19 17:36:45 PDT
Committed
r191324
: <
http://trac.webkit.org/changeset/191324
>
WebKit Commit Bot
Comment 28
2015-10-19 19:40:36 PDT
Re-opened since this is blocked by
bug 150352
Daniel Bates
Comment 29
2016-04-23 12:27:58 PDT
Comment on
attachment 263536
[details]
Patch Clearing review flag so that this patch does not appear in the review queue. This patch was committed in <
http://trac.webkit.org/changeset/191324
> per
comment #27
.
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