minor fixes
This commit is contained in:
parent
794fa4c3c1
commit
55ca6ed230
|
@ -0,0 +1,73 @@
|
|||
#include "hb-ot-color-colr-table.hh"
|
||||
|
||||
namespace OT {
|
||||
|
||||
void PaintColrLayers::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
const LayerList &paint_offset_lists = c->get_colr_table ()->get_layerList ();
|
||||
for (unsigned i = firstLayerIndex; i < firstLayerIndex + numLayers; i++)
|
||||
{
|
||||
const Paint &paint = std::addressof (paint_offset_lists) + paint_offset_lists[i];
|
||||
c->funcs->push_group (c->data);
|
||||
paint_glyph_dispatch (&paint, c);
|
||||
c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
|
||||
}
|
||||
}
|
||||
|
||||
void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
|
||||
{
|
||||
const COLR *colr_table = c->get_colr_table ();
|
||||
const Paint *paint = colr_table->get_base_glyph_paint (gid);
|
||||
|
||||
if (paint)
|
||||
paint_glyph_dispatch (paint, c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unsigned int
|
||||
hb_color_line_get_color_stops (hb_color_line_t *cl,
|
||||
unsigned int start,
|
||||
unsigned int *count,
|
||||
hb_color_stop_t *color_stops)
|
||||
{
|
||||
switch (cl->format)
|
||||
{
|
||||
case 4:
|
||||
return reinterpret_cast<const OT::PaintLinearGradient<OT::NoVariable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
case 5:
|
||||
return reinterpret_cast<const OT::PaintLinearGradient<OT::Variable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
case 6:
|
||||
return reinterpret_cast<const OT::PaintRadialGradient<OT::NoVariable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
case 7:
|
||||
return reinterpret_cast<const OT::PaintRadialGradient<OT::Variable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
case 8:
|
||||
return reinterpret_cast<const OT::PaintSweepGradient<OT::NoVariable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
case 9:
|
||||
return reinterpret_cast<const OT::PaintSweepGradient<OT::Variable> *>(cl->base)->get_color_stops (start, count, color_stops);
|
||||
default: assert (0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
hb_paint_extend_t
|
||||
hb_color_line_get_extend (hb_color_line_t *cl)
|
||||
{
|
||||
switch (cl->format)
|
||||
{
|
||||
case 4:
|
||||
return reinterpret_cast<const OT::PaintLinearGradient<OT::NoVariable> *>(cl->base)->get_extend ();
|
||||
case 5:
|
||||
return reinterpret_cast<const OT::PaintLinearGradient<OT::Variable> *>(cl->base)->get_extend ();
|
||||
case 6:
|
||||
return reinterpret_cast<const OT::PaintRadialGradient<OT::NoVariable> *>(cl->base)->get_extend ();
|
||||
case 7:
|
||||
return reinterpret_cast<const OT::PaintRadialGradient<OT::Variable> *>(cl->base)->get_extend ();
|
||||
case 8:
|
||||
return reinterpret_cast<const OT::PaintSweepGradient<OT::NoVariable> *>(cl->base)->get_extend ();
|
||||
case 9:
|
||||
return reinterpret_cast<const OT::PaintSweepGradient<OT::Variable> *>(cl->base)->get_extend ();
|
||||
default: assert (0);
|
||||
}
|
||||
return HB_PAINT_EXTEND_PAD;
|
||||
}
|
|
@ -1916,9 +1916,14 @@ struct COLR
|
|||
{
|
||||
const BaseGlyphList &baseglyph_paintrecords = this+baseGlyphList;
|
||||
const BaseGlyphPaintRecord* record = get_base_glyph_paintrecord (glyph);
|
||||
if (record)
|
||||
{
|
||||
const Paint &paint = &baseglyph_paintrecords+record->paint;
|
||||
return &paint;
|
||||
}
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
|
||||
|
|
Loading…
Reference in New Issue