mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-22 07:21:06 +01:00
[glyf] Mover decycler to the scratch pad
This commit is contained in:
1 parent
d59d435ec6
commit
64dbeaf0f4
3 files changed
+11
-13
No files matched your search
@@ -3,7 +3,6 @@
|
||||
|
||||
|
||||
#include "../../hb-open-type.hh"
|
||||
#include "../../hb-decycler.hh"
|
||||
|
||||
#include "GlyphHeader.hh"
|
||||
#include "SimpleGlyph.hh"
|
||||
@@ -315,7 +314,6 @@ struct Glyph
|
||||
bool use_my_metrics = true,
|
||||
bool phantom_only = false,
|
||||
hb_array_t<const int> coords = hb_array_t<const int> (),
|
||||
hb_decycler_t *decycler = nullptr,
|
||||
unsigned int depth = 0,
|
||||
unsigned *edge_count = nullptr) const
|
||||
{
|
||||
@@ -421,11 +419,7 @@ struct Glyph
|
||||
break;
|
||||
case COMPOSITE:
|
||||
{
|
||||
hb_decycler_t decycler_stack; // TODO Move out of here
|
||||
if (!decycler)
|
||||
decycler = &decycler_stack;
|
||||
|
||||
hb_decycler_node_t decycler_node (*decycler);
|
||||
hb_decycler_node_t decycler_node (scratch.decycler);
|
||||
|
||||
unsigned int comp_index = 0;
|
||||
for (auto &item : get_composite_iterator ())
|
||||
@@ -453,7 +447,6 @@ struct Glyph
|
||||
use_my_metrics,
|
||||
phantom_only,
|
||||
coords,
|
||||
decycler,
|
||||
depth + 1,
|
||||
edge_count)))
|
||||
{
|
||||
|
||||
+8
-5
@@ -89,7 +89,7 @@ struct hb_decycler_t
|
||||
friend struct hb_decycler_node_t;
|
||||
|
||||
private:
|
||||
bool tortoise_asleep = true;
|
||||
bool tortoise_awake = false;
|
||||
hb_decycler_node_t *tortoise = nullptr;
|
||||
hb_decycler_node_t *hare = nullptr;
|
||||
};
|
||||
@@ -100,15 +100,18 @@ struct hb_decycler_node_t
|
||||
{
|
||||
u.decycler = &decycler;
|
||||
|
||||
decycler.tortoise_asleep = !decycler.tortoise_asleep;
|
||||
decycler.tortoise_awake = !decycler.tortoise_awake;
|
||||
|
||||
if (!decycler.tortoise)
|
||||
{
|
||||
// First node.
|
||||
assert (decycler.tortoise_awake);
|
||||
assert (!decycler.hare);
|
||||
decycler.tortoise = decycler.hare = this;
|
||||
return;
|
||||
}
|
||||
if (!decycler.tortoise_asleep)
|
||||
|
||||
if (decycler.tortoise_awake)
|
||||
decycler.tortoise = decycler.tortoise->u.next; // Time to move.
|
||||
|
||||
this->prev = decycler.hare;
|
||||
@@ -128,10 +131,10 @@ struct hb_decycler_node_t
|
||||
prev->u.decycler = &decycler;
|
||||
|
||||
assert (decycler.tortoise);
|
||||
if (!decycler.tortoise_asleep)
|
||||
if (decycler.tortoise_awake)
|
||||
decycler.tortoise = decycler.tortoise->prev;
|
||||
|
||||
decycler.tortoise_asleep = !decycler.tortoise_asleep;
|
||||
decycler.tortoise_awake = !decycler.tortoise_awake;
|
||||
}
|
||||
|
||||
bool visit (uintptr_t value_)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#ifndef HB_OT_VAR_GVAR_TABLE_HH
|
||||
#define HB_OT_VAR_GVAR_TABLE_HH
|
||||
|
||||
#include "hb-decycler.hh"
|
||||
#include "hb-open-type.hh"
|
||||
#include "hb-ot-var-common.hh"
|
||||
|
||||
@@ -43,6 +44,7 @@ struct hb_glyf_scratch_t
|
||||
// glyf
|
||||
contour_point_vector_t all_points;
|
||||
contour_point_vector_t comp_points;
|
||||
hb_decycler_t decycler;
|
||||
|
||||
// gvar
|
||||
contour_point_vector_t orig_points;
|
||||
|
||||
Reference in new issue
Block a user