mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
A more radical approach to inset background painting
Now by default all insets paint their own background when needed. This means that63cf3297
and part of9940acc5
can be reverted. To avoid extra painting, background drawing is disabled for InsetCommand and InsetCollapsable. These insets draw background as part of their normal drawing activity. This will avoid drawing artifacts with InsetNewpage, InsetVSpace and probably some others.
This commit is contained in:
parent
6f82f51cbe
commit
e194c9ce27
@ -520,6 +520,16 @@ void Inset::metricsMarkers2(Dimension & dim, int framesize) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Inset::drawBackground(PainterInfo & pi, int x, int y) const
|
||||||
|
{
|
||||||
|
if (pi.full_repaint && backgroundColor(pi) == Color_none)
|
||||||
|
return;
|
||||||
|
Dimension const dim = dimension(*pi.base.bv);
|
||||||
|
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
|
||||||
|
pi.backgroundColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
|
void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
|
ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
|
||||||
|
@ -190,7 +190,7 @@ public:
|
|||||||
virtual void drawSelection(PainterInfo &, int, int) const {}
|
virtual void drawSelection(PainterInfo &, int, int) const {}
|
||||||
/// draw inset background if the inset has an own background and a
|
/// draw inset background if the inset has an own background and a
|
||||||
/// selection is drawn by drawSelection.
|
/// selection is drawn by drawSelection.
|
||||||
virtual void drawBackground(PainterInfo &, int, int) const {}
|
virtual void drawBackground(PainterInfo &, int, int) const;
|
||||||
///
|
///
|
||||||
virtual bool editing(BufferView const * bv) const;
|
virtual bool editing(BufferView const * bv) const;
|
||||||
///
|
///
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
///
|
||||||
|
virtual void drawBackground(PainterInfo &, int, int) const {}
|
||||||
|
|
||||||
/// return x,y of given position relative to the inset's baseline
|
/// return x,y of given position relative to the inset's baseline
|
||||||
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
||||||
|
@ -78,6 +78,8 @@ public:
|
|||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
|
virtual void drawBackground(PainterInfo &, int, int) const {}
|
||||||
|
///
|
||||||
void latex(otexstream &, OutputParams const &) const;
|
void latex(otexstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int plaintext(odocstringstream & ods, OutputParams const & op,
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
||||||
|
@ -211,16 +211,6 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::drawBackground(PainterInfo & pi, int x, int y) const
|
|
||||||
{
|
|
||||||
if (pi.full_repaint)
|
|
||||||
return;
|
|
||||||
Dimension const dim = dimension(*pi.base.bv);
|
|
||||||
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
|
|
||||||
pi.backgroundColor(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
|
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
FontInfo font = pi.base.font;
|
FontInfo font = pi.base.font;
|
||||||
|
@ -70,8 +70,6 @@ public:
|
|||||||
///
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void drawBackground(PainterInfo & pi, int x, int y) const;
|
|
||||||
///
|
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
void write(std::ostream &) const;
|
void write(std::ostream &) const;
|
||||||
|
@ -134,16 +134,6 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::drawBackground(PainterInfo & pi, int x, int y) const
|
|
||||||
{
|
|
||||||
if (pi.full_repaint)
|
|
||||||
return;
|
|
||||||
Dimension const dim = dimension(*pi.base.bv);
|
|
||||||
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
|
|
||||||
pi.backgroundColor(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// helper function: draw text and update x.
|
// helper function: draw text and update x.
|
||||||
|
@ -61,8 +61,6 @@ public:
|
|||||||
///
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void drawBackground(PainterInfo & pi, int x, int y) const;
|
|
||||||
///
|
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
void write(std::ostream &) const;
|
void write(std::ostream &) const;
|
||||||
|
@ -583,17 +583,6 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathMacroTemplate::drawBackground(PainterInfo & pi, int x, int y) const
|
|
||||||
{
|
|
||||||
if (pi.full_repaint)
|
|
||||||
return;
|
|
||||||
Dimension const dim = dimension(*pi.base.bv);
|
|
||||||
pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
|
|
||||||
pi.backgroundColor(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
|
void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
// FIXME: Calling Changer on the same object repeatedly is inefficient.
|
// FIXME: Calling Changer on the same object repeatedly is inefficient.
|
||||||
|
@ -92,8 +92,6 @@ public:
|
|||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
void drawBackground(PainterInfo & pi, int x, int y) const;
|
|
||||||
///
|
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
/// identifies macro templates
|
/// identifies macro templates
|
||||||
MathMacroTemplate * asMacroTemplate() { return this; }
|
MathMacroTemplate * asMacroTemplate() { return this; }
|
||||||
|
Loading…
Reference in New Issue
Block a user