Implement DisplayListRecorder::Recorder::getCTM and DisplayListRecorder::Recorder...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2019 03:49:14 +0000 (03:49 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Dec 2019 03:49:14 +0000 (03:49 +0000)
commit61960bfee4eb5087ea36afd48e2c946b653a3181
tree19a77a886739cfbb528e4539e3ba79d0f1d65f2a
parent13772c062e89102d3ddd24a0832f12fc9af044ae
Implement DisplayListRecorder::Recorder::getCTM and DisplayListRecorder::Recorder::setCTM
https://bugs.webkit.org/show_bug.cgi?id=205139

Reviewed by Simon Fraser.

Source/WebCore:

Implements these two methods on Recorder, which are invoked from GraphicsContext::setCTM and
GraphicsContext::getCTM, respectively. See below for more details.

Additionally rebaselines displaylists/extent-includes-transforms.html.

* platform/graphics/displaylists/DisplayList.h:

Add a new type to represent the SetCTM display list item.

(WebCore::DisplayList::Item::isStateItemType):
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::Item::sizeInBytes):
(WebCore::DisplayList::SetCTM::SetCTM):
(WebCore::DisplayList::SetCTM::apply const):
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::SetCTM::create):
(WebCore::DisplayList::SetCTM::transform const):
(WebCore::DisplayList::SetCTM::encode const):
(WebCore::DisplayList::SetCTM::decode):
(WebCore::DisplayList::Item::encode const):
(WebCore::DisplayList::Item::decode):

Add DisplayList::SetCTM, which represents a call to set the current transformation matrix on the graphics
context. This is very similar to ConcatCTM.

* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::setCTM):

Set the current state's CTM to the new value. Additionally, update clipBounds by applying the inverse
transformation matrix of the inverse of the original CTM, multiplied by the new CTM. This is because setting
the CTM from to `B` from `A` is equivalent to multiplying `A` by `A_inverse * B`, so we want to map the clip
rect through the inverse of this matrix, `(A_inverse * B)_inverse`.

(WebCore::DisplayList::Recorder::getCTM):

Return the current CTM by asking the topmost state on the stack, and ignore the IncludeDeviceScale flag for the
time being.

(WebCore::DisplayList::Recorder::ContextState::setCTM):
* platform/graphics/displaylists/DisplayListRecorder.h:

LayoutTests:

* displaylists/extent-includes-transforms-expected.txt:
* platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/displaylists/extent-includes-transforms-expected.txt
LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/displaylists/DisplayList.h
Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h