зеркало из https://github.com/mozilla/pjs.git
Bug 662038, part 0: Add gfxContext::CurrentDash(). r=jrmuizel
This commit is contained in:
Родитель
2323c82dfc
Коммит
5e5adb0495
|
@ -545,7 +545,28 @@ gfxContext::SetDash(gfxFloat *dashes, int ndash, gfxFloat offset)
|
|||
{
|
||||
cairo_set_dash(mCairo, dashes, ndash, offset);
|
||||
}
|
||||
//void getDash() const;
|
||||
|
||||
bool
|
||||
gfxContext::CurrentDash(FallibleTArray<gfxFloat>& dashes, gfxFloat* offset) const
|
||||
{
|
||||
int count = cairo_get_dash_count(mCairo);
|
||||
if (count <= 0 || !dashes.SetLength(count)) {
|
||||
return false;
|
||||
}
|
||||
cairo_get_dash(mCairo, dashes.Elements(), offset);
|
||||
return true;
|
||||
}
|
||||
|
||||
gfxFloat
|
||||
gfxContext::CurrentDashOffset() const
|
||||
{
|
||||
if (cairo_get_dash_count(mCairo) <= 0) {
|
||||
return 0.0;
|
||||
}
|
||||
gfxFloat offset;
|
||||
cairo_get_dash(mCairo, NULL, &offset);
|
||||
return offset;
|
||||
}
|
||||
|
||||
void
|
||||
gfxContext::SetLineWidth(gfxFloat width)
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsISupportsImpl.h"
|
||||
|
||||
typedef struct _cairo cairo_t;
|
||||
template <typename T> class FallibleTArray;
|
||||
|
||||
/**
|
||||
* This is the main class for doing actual drawing. It is initialized using
|
||||
|
@ -465,7 +466,12 @@ public:
|
|||
|
||||
void SetDash(gfxLineType ltype);
|
||||
void SetDash(gfxFloat *dashes, int ndash, gfxFloat offset);
|
||||
//void getDash() const;
|
||||
// Return true if dashing is set, false if it's not enabled or the
|
||||
// context is in an error state. |offset| can be NULL to mean
|
||||
// "don't care".
|
||||
bool CurrentDash(FallibleTArray<gfxFloat>& dashes, gfxFloat* offset) const;
|
||||
// Returns 0.0 if dashing isn't enabled.
|
||||
gfxFloat CurrentDashOffset() const;
|
||||
|
||||
/**
|
||||
* Sets the line width that's used for line drawing.
|
||||
|
|
Загрузка…
Ссылка в новой задаче