Title: [258497] trunk/Source/WebCore
- Revision
- 258497
- Author
- [email protected]
- Date
- 2020-03-16 08:27:05 -0700 (Mon, 16 Mar 2020)
Log Message
[Cairo] Path copy constructor and operator must also copy over CTM
https://bugs.webkit.org/show_bug.cgi?id=183327
Patch by Zan Dobersek <[email protected]> on 2020-03-16
Reviewed by Carlos Garcia Campos.
Cairo implementations of Path copy constructor and assignment operator
must also copy over the current transformation matrix that's maintained
on the source path's cairo_t context.
cairo_copy_path() copies the current path off of a Cairo context, but
during that also transforms every point on the path through inverse of
the CTM, back into user coordinates. For copying to be done correctly,
the copied path must be transformed through the CTM when it's appended
to the target Cairo context. For that reason the CTM has to be copied
over from source to target context before the path is copied and
appended.
* platform/graphics/cairo/PathCairo.cpp:
(WebCore::Path::Path):
(WebCore::Path::operator=):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (258496 => 258497)
--- trunk/Source/WebCore/ChangeLog 2020-03-16 15:26:05 UTC (rev 258496)
+++ trunk/Source/WebCore/ChangeLog 2020-03-16 15:27:05 UTC (rev 258497)
@@ -1,3 +1,26 @@
+2020-03-16 Zan Dobersek <[email protected]>
+
+ [Cairo] Path copy constructor and operator must also copy over CTM
+ https://bugs.webkit.org/show_bug.cgi?id=183327
+
+ Reviewed by Carlos Garcia Campos.
+
+ Cairo implementations of Path copy constructor and assignment operator
+ must also copy over the current transformation matrix that's maintained
+ on the source path's cairo_t context.
+
+ cairo_copy_path() copies the current path off of a Cairo context, but
+ during that also transforms every point on the path through inverse of
+ the CTM, back into user coordinates. For copying to be done correctly,
+ the copied path must be transformed through the CTM when it's appended
+ to the target Cairo context. For that reason the CTM has to be copied
+ over from source to target context before the path is copied and
+ appended.
+
+ * platform/graphics/cairo/PathCairo.cpp:
+ (WebCore::Path::Path):
+ (WebCore::Path::operator=):
+
2020-03-16 youenn fablet <[email protected]>
Unique origins should not be Potentially Trustworthy
Modified: trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp (258496 => 258497)
--- trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp 2020-03-16 15:26:05 UTC (rev 258496)
+++ trunk/Source/WebCore/platform/graphics/cairo/PathCairo.cpp 2020-03-16 15:27:05 UTC (rev 258497)
@@ -60,8 +60,13 @@
if (other.isNull())
return;
+ cairo_t* cr = ensureCairoPath();
+ cairo_matrix_t ctm;
+ cairo_get_matrix(other.m_path.get(), &ctm);
+ cairo_set_matrix(cr, &ctm);
+
CairoUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(other.m_path.get()));
- cairo_append_path(ensureCairoPath(), pathCopy.get());
+ cairo_append_path(cr, pathCopy.get());
m_elements = other.m_elements;
}
@@ -84,8 +89,14 @@
}
clear();
+
+ cairo_t* cr = ensureCairoPath();
+ cairo_matrix_t ctm;
+ cairo_get_matrix(other.m_path.get(), &ctm);
+ cairo_set_matrix(cr, &ctm);
+
CairoUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(other.m_path.get()));
- cairo_append_path(ensureCairoPath(), pathCopy.get());
+ cairo_append_path(cr, pathCopy.get());
m_elements = other.m_elements;
return *this;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes