mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 655926: Implement canvas.mozFillRule. sr=vlad
This commit is contained in:
parent
913b9fcd24
commit
377e990c19
@ -1182,6 +1182,7 @@ nsCanvasRenderingContext2D::InitializeWithSurface(nsIDocShell *docShell, gfxASur
|
||||
mThebes->SetMiterLimit(10.0);
|
||||
mThebes->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
||||
mThebes->SetLineJoin(gfxContext::LINE_JOIN_MITER);
|
||||
mThebes->SetFillRule(gfxContext::FILL_RULE_WINDING);
|
||||
|
||||
mThebes->NewPath();
|
||||
|
||||
@ -1600,6 +1601,37 @@ nsCanvasRenderingContext2D::GetFillStyle_multi(nsAString& aStr, nsISupports **aI
|
||||
return GetStyleAsStringOrInterface(aStr, aInterface, aType, STYLE_FILL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::SetMozFillRule(const nsAString& aString)
|
||||
{
|
||||
gfxContext::FillRule rule;
|
||||
|
||||
if (aString.EqualsLiteral("evenodd"))
|
||||
rule = gfxContext::FILL_RULE_EVEN_ODD;
|
||||
else if (aString.EqualsLiteral("nonzero"))
|
||||
rule = gfxContext::FILL_RULE_WINDING;
|
||||
else
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return NS_OK;
|
||||
|
||||
mThebes->SetFillRule(rule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::GetMozFillRule(nsAString& aString)
|
||||
{
|
||||
switch (mThebes->CurrentFillRule()) {
|
||||
case gfxContext::FILL_RULE_WINDING:
|
||||
aString.AssignLiteral("nonzero"); break;
|
||||
case gfxContext::FILL_RULE_EVEN_ODD:
|
||||
aString.AssignLiteral("evenodd"); break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// gradients and patterns
|
||||
//
|
||||
|
@ -62,7 +62,7 @@ interface nsIDOMTextMetrics : nsISupports
|
||||
readonly attribute float width;
|
||||
};
|
||||
|
||||
[scriptable, uuid(408be1b9-4d75-4873-b50b-9b651626e41d)]
|
||||
[scriptable, uuid(bf5e52a3-6ec1-4a6e-8364-9f9222ec8edb)]
|
||||
interface nsIDOMCanvasRenderingContext2D : nsISupports
|
||||
{
|
||||
// back-reference to the canvas element for which
|
||||
@ -106,6 +106,9 @@ enum CanvasMultiGetterType {
|
||||
[noscript] void setFillStyle_multi(in DOMString str, in nsISupports iface);
|
||||
[noscript] void getFillStyle_multi(out DOMString str, out nsISupports iface, out long type);
|
||||
|
||||
//attribute DOMString fillRule;
|
||||
attribute DOMString mozFillRule; /* "evenodd", "nonzero" (default) */
|
||||
|
||||
nsIDOMCanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1);
|
||||
nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
|
||||
nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, in DOMString repetition);
|
||||
|
Loading…
Reference in New Issue
Block a user