Skip to content

Commit

Permalink
Refactor bit set and add.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcgi committed Jan 7, 2019
1 parent d780b5e commit 886a2e1
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 71 deletions.
16 changes: 8 additions & 8 deletions Engine/Graphics/Draw/Drawable.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void Draw(Drawable* drawable)
}

// flag transform for child and flag need update inverse
ADrawable_SetState(drawable, DrawableState_TransformChanged | DrawableState_UpdateInverse);
ADrawable_AddState(drawable, DrawableState_TransformChanged | DrawableState_UpdateInverse);
}
else
{
Expand All @@ -101,7 +101,7 @@ static void Draw(Drawable* drawable)
drawable->blendColor->a = drawable->color->a * drawable->parent->blendColor->a;

// flag rgb for child
ADrawable_SetState(drawable, DrawableState_OpacityChanged);
ADrawable_AddState(drawable, DrawableState_OpacityChanged);
}
else
{
Expand All @@ -116,7 +116,7 @@ static void Draw(Drawable* drawable)
drawable->blendColor->b = drawable->color->b * drawable->parent->blendColor->b;

// flag opacity for child
ADrawable_SetState(drawable, DrawableState_RGBChanged);
ADrawable_AddState(drawable, DrawableState_RGBChanged);
}
else
{
Expand All @@ -131,7 +131,7 @@ static void Draw(Drawable* drawable)
drawable->blendColor->a = drawable->color->a;

// flag rgb for child
ADrawable_SetState(drawable, DrawableState_OpacityChanged);
ADrawable_AddState(drawable, DrawableState_OpacityChanged);
}
else
{
Expand All @@ -146,7 +146,7 @@ static void Draw(Drawable* drawable)
drawable->blendColor->b = drawable->color->b;

// flag opacity for child
ADrawable_SetState(drawable, DrawableState_RGBChanged);
ADrawable_AddState(drawable, DrawableState_RGBChanged);
}
else
{
Expand All @@ -168,8 +168,8 @@ static void Draw(Drawable* drawable)
drawable->Draw(drawable);
}

// clear self all state change
ADrawable_ClearAndSetState(drawable, DrawableState_Change, DrawableState_DrawChanged);
// clear self all draw state change
ADrawable_ClearAndAddState(drawable, DrawableState_Draw, DrawableState_DrawChanged);

// if has render push into queue
if (drawable->Render != NULL)
Expand Down Expand Up @@ -613,7 +613,7 @@ static void Init(Drawable* outDrawable)

// first born make matrix update
// first born inverse matrix need update
ADrawable_SetState
ADrawable_AddState
(
outDrawable,
DrawableState_Transform |
Expand Down
Loading

0 comments on commit 886a2e1

Please sign in to comment.