WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
130580
[Cairo] Implement Path::addPath
https://bugs.webkit.org/show_bug.cgi?id=130580
Summary
[Cairo] Implement Path::addPath
Jae Hyun Park
Reported
2014-03-21 04:44:22 PDT
Add support for addPath method for platforms using cairo.
Attachments
Patch
(3.69 KB, patch)
2014-03-21 04:50 PDT
,
Jae Hyun Park
no flags
Details
Formatted Diff
Diff
Patch
(5.62 KB, patch)
2014-03-23 08:21 PDT
,
Jae Hyun Park
no flags
Details
Formatted Diff
Diff
Patch
(6.08 KB, patch)
2014-03-24 05:01 PDT
,
Jae Hyun Park
no flags
Details
Formatted Diff
Diff
Patch
(6.07 KB, patch)
2014-03-24 17:39 PDT
,
Jae Hyun Park
no flags
Details
Formatted Diff
Diff
Patch
(5.74 KB, patch)
2014-03-24 19:59 PDT
,
Jae Hyun Park
no flags
Details
Formatted Diff
Diff
Patch
(3.66 KB, patch)
2015-04-20 23:22 PDT
,
Jinwoo Song
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Jae Hyun Park
Comment 1
2014-03-21 04:50:56 PDT
Created
attachment 227415
[details]
Patch
WebKit Commit Bot
Comment 2
2014-03-21 04:53:53 PDT
Attachment 227415
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/cairo/PathCairo.cpp:302: c_matrix is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3
2014-03-21 10:16:47 PDT
Comment on
attachment 227415
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=227415&action=review
> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:310 > + OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(cr));
Please don’t use OwnPtr in new code. We are trying to get rid of OwnPtr. You should used std::unique_ptr in new code. I’m also surprised that it’s safe to call delete on a path returned from cairo_copy_path, but I guess that’s what the surrounding code already does. I think the way to write this with unique_ptr is something like this: std::unique_ptr<cairo_path_t> pathCopy { cairo_copy_path(cr) };
Martin Robinson
Comment 4
2014-03-21 10:23:25 PDT
Comment on
attachment 227415
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=227415&action=review
>> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:310 >> + OwnPtr<cairo_path_t> pathCopy = adoptPtr(cairo_copy_path(cr)); > > Please don’t use OwnPtr in new code. We are trying to get rid of OwnPtr. You should used std::unique_ptr in new code. I’m also surprised that it’s safe to call delete on a path returned from cairo_copy_path, but I guess that’s what the surrounding code already does. I think the way to write this with unique_ptr is something like this: > > std::unique_ptr<cairo_path_t> pathCopy { cairo_copy_path(cr) };
This works because we have a template specialization for cairo_path_t (template <> void deleteOwnedPtr<cairo_path_t>(cairo_path_t*);) in OwnPtrCairo.h. I think we could use GUniquePtr here, but we'd need to make a deleter using WTF_DEFINE_GPTR_DELETER.
Jae Hyun Park
Comment 5
2014-03-23 08:21:57 PDT
Created
attachment 227610
[details]
Patch
WebKit Commit Bot
Comment 6
2014-03-23 08:24:20 PDT
Attachment 227610
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/cairo/PathCairo.cpp:302: c_matrix is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Martin Robinson
Comment 7
2014-03-23 08:32:09 PDT
Comment on
attachment 227610
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=227610&action=review
> Source/WTF/wtf/gobject/GUniquePtr.h:41 > + macro(cairo_path_t, cairo_path_destroy) \
This isn't really the right place for this. We want to add this in a file alongside OwnPtrCairo.h, I think.
Jae Hyun Park
Comment 8
2014-03-24 05:01:44 PDT
Created
attachment 227637
[details]
Patch
WebKit Commit Bot
Comment 9
2014-03-24 05:02:38 PDT
Attachment 227637
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/cairo/PathCairo.cpp:302: c_matrix is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jae Hyun Park
Comment 10
2014-03-24 05:08:25 PDT
It seems like other cairo_matrix_t in PathCairo.cpp is named c_matrix, which is not in accordance with webkit style. Would it be better if I rename cairo_matrix_t c_matrix to matrix to pass the style check? Or is it a convention for cairo_matrix_t?
Martin Robinson
Comment 11
2014-03-24 08:59:29 PDT
(In reply to
comment #10
)
> It seems like other cairo_matrix_t in PathCairo.cpp is named c_matrix, which is not in accordance with webkit style. > > Would it be better if I rename cairo_matrix_t c_matrix to matrix to pass the style check? Or is it a convention for cairo_matrix_t?
I think it would be better to fix the name.
Jae Hyun Park
Comment 12
2014-03-24 17:39:22 PDT
Created
attachment 227708
[details]
Patch
Martin Robinson
Comment 13
2014-03-24 18:37:58 PDT
Comment on
attachment 227708
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=227708&action=review
> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:302 > + cairo_matrix_t matrix = cairo_matrix_t(transform);
Do you need to use the explicit constructor here or is assignment enough?
> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:317 > + if (path.platformPath() == ensurePlatformPath()) { > + Path clonePath(path); > + cairo_t* cr = clonePath.platformPath()->context(); > + cairo_transform(cr, &matrix); > + GUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(cr)); > + cairo_append_path(ensurePlatformPath()->context(), pathCopy.get()); > + } else { > + cairo_t* cr = path.platformPath()->context(); > + cairo_transform(cr, &matrix); > + GUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(cr)); > + cairo_append_path(ensurePlatformPath()->context(), pathCopy.get()); > + }
I don't know if you need a special case for appending the path to itself. You always make a copy of the cairo_path_t anyway. There's a bug here, which is that you transform the Path and then don't restore the previous transformation.
Jae Hyun Park
Comment 14
2014-03-24 19:59:39 PDT
Created
attachment 227717
[details]
Patch
Jae Hyun Park
Comment 15
2014-03-24 20:05:57 PDT
(In reply to
comment #13
)
> (From update of
attachment 227708
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=227708&action=review
> > > Source/WebCore/platform/graphics/cairo/PathCairo.cpp:302 > > + cairo_matrix_t matrix = cairo_matrix_t(transform); > > Do you need to use the explicit constructor here or is assignment enough?
I used one constructor instead of constructor + assignment in the latest patch.
> > > Source/WebCore/platform/graphics/cairo/PathCairo.cpp:317 > > + if (path.platformPath() == ensurePlatformPath()) { > > + Path clonePath(path); > > + cairo_t* cr = clonePath.platformPath()->context(); > > + cairo_transform(cr, &matrix); > > + GUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(cr)); > > + cairo_append_path(ensurePlatformPath()->context(), pathCopy.get()); > > + } else { > > + cairo_t* cr = path.platformPath()->context(); > > + cairo_transform(cr, &matrix); > > + GUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(cr)); > > + cairo_append_path(ensurePlatformPath()->context(), pathCopy.get()); > > + } > > I don't know if you need a special case for appending the path to itself. You always make a copy of the cairo_path_t anyway. There's a bug here, which is that you transform the Path and then don't restore the previous transformation.
Fixed. Thanks for the review!
Dirk Schulze
Comment 16
2014-04-03 01:16:33 PDT
***
Bug 130464
has been marked as a duplicate of this bug. ***
Dirk Schulze
Comment 17
2014-04-03 01:19:39 PDT
Comment on
attachment 227717
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=227717&action=review
> Source/WebCore/platform/graphics/cairo/PathCairo.cpp:309 > + GUniquePtr<cairo_path_t> pathCopy(cairo_copy_path(cr));
Are you sure that you need a copy of the path? We had addPath implemented in the past. I don't think we copied it.
Jae Hyun Park
Comment 18
2014-04-03 08:19:24 PDT
(In reply to
comment #17
)
> (From update of
attachment 227717
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=227717&action=review
> Are you sure that you need a copy of the path? We had addPath implemented in the past. I don't think we copied it.
If you mean addPath that was implemented in GraphicsContextCairo, it used appendWebCorePathToCairoContext(), which calls appendPathToCairoContext(). In appendPathToCairoContext, it calls cairo_copy_path() and cairo_append_path.
Dirk Schulze
Comment 19
2014-05-07 06:02:37 PDT
Comment on
attachment 227717
[details]
Patch r=me
Jae Hyun Park
Comment 20
2014-05-10 00:36:18 PDT
(In reply to
comment #19
)
> (From update of
attachment 227717
[details]
) > r=me
Thanks for the review. However, this patch cannot be committed right now because we cannot use GUniquePtr for cairo_path_t as WinCairo port does not glib. Would it be ok if i used OwnPtr<cairo_path_t> for now, and change the use of OwnPtrCairo altogether in 131531 bug?
Jinwoo Song
Comment 21
2015-04-20 22:48:21 PDT
Jae Hyun Park, is there any progress? If you don't mind, I'd like to propose to use std::unique_ptr with custom deleter.
Jae Hyun Park
Comment 22
2015-04-20 22:55:12 PDT
(In reply to
comment #21
)
> Jae Hyun Park, is there any progress? If you don't mind, I'd like to propose > to use std::unique_ptr with custom deleter.
Please go ahead. I'm in no condition to work on this for a while.
Jinwoo Song
Comment 23
2015-04-20 23:22:02 PDT
Created
attachment 251219
[details]
Patch
Jinwoo Song
Comment 24
2015-04-20 23:24:33 PDT
Martin, Dirk, could you review this patch?
Dirk Schulze
Comment 25
2015-04-21 02:45:01 PDT
Comment on
attachment 251219
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=251219&action=review
r=me with comment.
> LayoutTests/platform/efl/TestExpectations:-221 > -
webkit.org/b/130464
fast/canvas/canvas-path-addPath.html
What about the Gtk port? Doesn't it have such a line as well?
Jinwoo Song
Comment 26
2015-04-21 02:54:28 PDT
Comment on
attachment 251219
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=251219&action=review
>> LayoutTests/platform/efl/TestExpectations:-221 >> -
webkit.org/b/130464
fast/canvas/canvas-path-addPath.html > > What about the Gtk port? Doesn't it have such a line as well?
Yes, but GTK port disabled this feature as default. GTK guys may update TestExpectations after enable CANVAS_PATH in another patch. cmake/OptionsGTK.cmake:159:WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PATH OFF)
WebKit Commit Bot
Comment 27
2015-04-21 17:39:12 PDT
Comment on
attachment 251219
[details]
Patch Clearing flags on attachment: 251219 Committed
r183088
: <
http://trac.webkit.org/changeset/183088
>
WebKit Commit Bot
Comment 28
2015-04-21 17:39:20 PDT
All reviewed patches have been landed. Closing bug.
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