[Webkit-unassigned] [Bug 108897] [Cairo] Canvas-shadow behavior is not being as expected
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue May 7 05:57:08 PDT 2013
https://bugs.webkit.org/show_bug.cgi?id=108897
--- Comment #60 from Rashmi Shyamasundar <rashmi.s2 at samsung.com> 2013-05-07 05:55:30 PST ---
Dear Mr. Robinson,
Thank you very much for your comments. From the discussion we have had so far, I realize that this issue can be solved in 2 ways -
1. CAIRO_EXTEND_PAD - As you said, if the rect is properly defined then, "CAIRO_EXTEND_PAD" will take care of scaling the source image to the required destination-rect-size.
In this current shadow issue, the destination-rect is properly defined in PlatformContextCairo::drawPatternToCairoContext(). But, on this context, another rect(for drawing the original image, not the shadow) has already been defined in GraphicsContext::fillRect(). So, when cairo_fill() is called in PlatformContextCairo::drawPatternToCairoContext(), both the rects get filled with the shadow.
Hence we need to make sure that only the shadow-rect is part of the cairo-path when we are drawing the shadow. This can be achieved with the below lines of code in PlatformContextCairo::drawPatternToCairoContext().
static void drawPatternToCairoContext(cairo_t* cr, cairo_pattern_t* pattern, const FloatRect& destRect, float alpha)
{
cairo_translate(cr, destRect.x(), destRect.y());
cairo_set_source(cr, pattern);
cairo_save(cr); //Save cairo-state
cairo_new_path(cr); //Clear the cairo-path
cairo_rectangle(cr, 0, 0, destRect.width(), destRect.height());
if (alpha < 1) {
cairo_clip(cr);
cairo_paint_with_alpha(cr, alpha);
} else
cairo_fill(cr);
cairo_restore(cr); //Restore the cairo-state and hence the cairo-path
}
I ran all the canvas layouttests, with the above fix. Its working fine. I have not run all other layouttests. Is there a way to quickly compare the layout test results, with and without the fix?
2. CAIRO_EXTEND_NONE - In this case, we will have to depend on the cairo-matrix and hence the cairo-filters for scaling the source image to the destination-rect size.
There seems to be an issue with the bilinear filter in cairo. Please check https://bugs.webkit.org/show_bug.cgi?id=108897#c50 . Please open the images (mentioned in comment#50), using "Image Viewer" on linux which shows the image with a checker-box background. This background will highlight the issue.
Do you think I can raise a bug on Cairo-bilinear-filter, using this sample cairo program?
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list