[depend] COLR depend context cleanup: void dispatch, typed pointer, HB_INTERNAL

- Switch hb_colrv1_depend_context_t from bool-returning to void-style
  dispatch (matching closure context pattern)
- Replace const void *base with const COLR *colr (typed, no reinterpret_cast)
- Empty gradient dependv1 methods (ColorLine/ColorStop hold palette indices,
  not glyph IDs)
- Remove dead clip dependv1 code (ClipRecord/ClipBox/ClipBoxFormat2 never
  called from COLR::depend())
- Add HB_INTERNAL to out-of-class dependv1/closurev1 declarations for
  PaintColrLayers, PaintGlyph, PaintColrGlyph, PaintComposite
- Remove no-op (this+transform).dependv1(c) from PaintTransform::dependv1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Skef IterumandClaude Sonnet 4.6 committed 2026-06-05 15:09:12 -07:00
1 parent ee2160665c
commit c88b20d2d0
2 files changed
+21 -55

No files matched your search

+21 -54
View File
@@ -226,37 +226,37 @@ struct hb_colrv1_closure_context_t :
{}
};
#ifndef HB_NO_SUBSET_DEPEND
#ifndef HB_NO_SUBSET_DEPEND
struct hb_colrv1_depend_context_t :
hb_dispatch_context_t<hb_colrv1_depend_context_t, bool>
hb_dispatch_context_t<hb_colrv1_depend_context_t>
{
template <typename T>
return_t dispatch (const T &obj)
{
if (unlikely (nesting_level_left == 0))
return false;
return hb_empty_t ();
nesting_level_left--;
obj.dependv1 (this);
nesting_level_left++;
return true;
return hb_empty_t ();
}
static return_t default_return_value () { return false; }
static return_t default_return_value () { return hb_empty_t (); }
const COLR* get_colr_table () const
{ return reinterpret_cast<const COLR *> (base); }
{ return colr; }
public:
const void *base;
const COLR *colr;
hb_depend_data_builder_t *depend_data;
unsigned nesting_level_left;
hb_codepoint_t source_gid;
hb_colrv1_depend_context_t (const void *base_,
hb_colrv1_depend_context_t (const COLR *colr_,
hb_depend_data_builder_t *depend_data_,
unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
base (base_),
colr (colr_),
depend_data (depend_data_),
nesting_level_left (nesting_level_left_),
source_gid (0)
@@ -520,11 +520,7 @@ template <template<typename> class Var>
struct ColorLine
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t * c) const
{
for (const auto &stop : stops.iter ())
stop.dependv1 (c);
}
void dependv1 (hb_colrv1_depend_context_t * c) const {}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -723,9 +719,9 @@ struct Affine2x3
struct PaintColrLayers
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer HB_UNUSED) const
@@ -812,10 +808,7 @@ template <template<typename> class Var>
struct PaintLinearGradient
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
}
void dependv1 (hb_colrv1_depend_context_t* c) const {}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -889,10 +882,7 @@ template <template<typename> class Var>
struct PaintRadialGradient
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
}
void dependv1 (hb_colrv1_depend_context_t* c) const {}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -966,10 +956,7 @@ template <template<typename> class Var>
struct PaintSweepGradient
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+colorLine).dependv1 (c);
}
void dependv1 (hb_colrv1_depend_context_t* c) const {}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
@@ -1037,9 +1024,9 @@ struct PaintSweepGradient
struct PaintGlyph
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer) const
@@ -1083,9 +1070,9 @@ struct PaintGlyph
struct PaintColrGlyph
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer HB_UNUSED) const
@@ -1634,9 +1621,9 @@ struct PaintSkewAroundCenter
struct PaintComposite
{
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
HB_INTERNAL void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const;
HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
bool subset (hb_subset_context_t *c,
const ItemVarStoreInstancer &instancer) const
@@ -1746,9 +1733,6 @@ struct ClipBoxFormat2 : Variable<ClipBoxFormat1>
}
}
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const;
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
{ c->variation_indices->add_range (varIdxBase, varIdxBase + 3); }
};
@@ -1766,16 +1750,6 @@ struct ClipBox
}
}
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c) const
{
switch (u.format.v) {
case 2: u.format2.dependv1 (c);
default:return;
}
}
#endif
void closurev1 (hb_colrv1_closure_context_t* c) const
{
switch (u.format.v) {
@@ -1831,13 +1805,6 @@ struct ClipRecord
int cmp (hb_codepoint_t g) const
{ return g < startGlyphID ? -1 : g <= endGlyphID ? 0 : +1; }
#ifndef HB_NO_SUBSET_DEPEND
void dependv1 (hb_colrv1_depend_context_t* c, const void *base) const
{
(base+clipBox).dependv1 (c);
}
#endif
void closurev1 (hb_colrv1_closure_context_t* c, const void *base) const
{
if (!c->glyphs->intersects (startGlyphID, endGlyphID)) return;
-1
View File
@@ -73,7 +73,6 @@ template <template<typename> class Var>
HB_INTERNAL void PaintTransform<Var>::dependv1 (hb_colrv1_depend_context_t* c) const
{
(this+src).dispatch (c);
(this+transform).dependv1 (c);
}
HB_INTERNAL void PaintTranslate::dependv1 (hb_colrv1_depend_context_t* c) const