<commit_before>/******************************************************************************

    SDL Line Primitive; line computation logic derives from Bresenham's line
  algorithm

  Copyright (c) 2013 <NAME>
  All rights reserved.

******************************************************************************/
#include "nomlib/gfx/SDL_Line.hpp"

namespace nom {

Line::Line ( void )
{
  this->pixels.clear();

  this->setPosition ( 0, 0 );
  this->setSize ( 0, 0 );
  this->setColor ( 0, 0, 0, 255 );
}

Line::~Line ( void )
{

  this->pixels.clear();
}

Line::Line ( const Coords& coords, const Color& color )
{
  this->pixels.clear();

  this->coords = coords;
  this->color = color;
}

Line::Line ( int32_t x, int32_t y, int32_t width, int32_t height, const Color& color )
{
  this->pixels.clear();

  this->setPosition ( Coords ( x, y, width, height ) );
  this->setColor ( color );
}

// Recompute line offsets
void Line::Update ( void )
{
  // temporary calculation offsets based on user's initial given coordinates
  int32_t x1 = this->coords.x;
  int32_t y1 = this->coords.y;
  int32_t x2 = this->coords.width;
  int32_t y2 = this->coords.height;

  // A surprisingly fast growing memory leak occurs here if we do not clear our
  // pixels array every update cycle
  this->pixels.clear();

  bool steep = ( fabs ( y2 - y1 ) > fabs ( x2 - x1 ) );<commit_msg>Update nom::Line object when we construct a new line<commit_after>/******************************************************************************

    SDL Line Primitive; line computation logic derives from Bresenham's line
  algorithm

  Copyright (c) 2013 <NAME>
  All rights reserved.

******************************************************************************/
#include "nomlib/gfx/SDL_Line.hpp"

namespace nom {

Line::Line ( void )
{
  this->pixels.clear();

  this->setPosition ( 0, 0 );
  this->setSize ( 0, 0 );
  this->setColor ( 0, 0, 0, 255 );
}

Line::~Line ( void )
{

  this->pixels.clear();
}

Line::Line ( const Coords& coords, const Color& color )
{
  this->coords = coords;
  this->color = color;

  this->Update();
}

Line::Line ( int32_t x, int32_t y, int32_t width, int32_t height, const Color& color )
{
  this->setPosition ( Coords ( x, y, width, height ) );
  this->setColor ( color );

  this->Update();
}

// Recompute line offsets
void Line::Update ( void )
{
  // temporary calculation offsets based on user's initial given coordinates
  int32_t x1 = this->coords.x;
  int32_t y1 = this->coords.y;
  int32_t x2 = this->coords.width;
  int32_t y2 = this->coords.height;

  // A surprisingly fast growing memory leak occurs here if we do not clear our
  // pixels array every update cycle
  this->pixels.clear();

  bool steep = ( fabs ( y2 - y1 ) > fabs ( x2 - x1 ) );
{'fraction_non_alphanumeric': 0.23512441399206635, 'fraction_numerical': 0.02740714028128381, 'mean_word_length': 3.791018998272884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3997192', 'n_tokens_mistral': 951, 'n_tokens_neox': 868, 'n_words': 264}