Beispiel #1
0
std::vector<std::string> manager::get_required_not_enabled(const elem& e) const
{
	std::vector<std::string> required = get_required(e);
	std::vector<std::string> result;

	BOOST_FOREACH (std::string str, required) {
		if ( !util::contains(mods_, str) ) {
			result.push_back(str);
		}
	}

	return result;
}
Beispiel #2
0
static GeglRectangle
get_required_for_output (GeglOperation       *operation,
                         const gchar         *input_pad,
                         const GeglRectangle *roi)
{
  GeglRectangle *boundary;

  boundary = gegl_operation_source_get_bounding_box (operation, "input");

  if (strcmp (input_pad, "input") || !boundary)
    return *GEGL_RECTANGLE (0, 0, 0, 0);

  return get_required (boundary, roi, operation);
}
Beispiel #3
0
std::vector<std::string>
		manager::get_required_not_installed(const elem& e) const
{
	std::vector<std::string> result;

	std::vector<std::string> items = get_required(e);

	BOOST_FOREACH (const std::string& str, items) {
		if (!exists(elem(str, "modification"))) {
			result.push_back(str);
		}
	}

	return result;
}
Beispiel #4
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
  GeglChantO    *o = GEGL_CHANT_PROPERTIES (operation);
  LensValues     lens;
  GeglRectangle  boundary;
  gint           i, j;
  gfloat        *src_buf, *dst_buf;
  gfloat         background[4];

  boundary = *gegl_operation_source_get_bounding_box (operation, "input");
  lens     =  lens_setup_calc (o, boundary);

  src_buf = g_new0 (gfloat, SQR (MAX_WH) * 4);
  dst_buf = g_new0 (gfloat, SQR (CHUNK_SIZE) * 4);

  gegl_color_get_pixel (o->background, babl_format ("RGBA float"), background);

  for (j = 0; (j-1) * CHUNK_SIZE < result->height; j++)
    for (i = 0; (i-1) * CHUNK_SIZE < result->width; i++)
      {
        GeglRectangle chunked_result;
        GeglRectangle area;
        gint          x, y;

        chunked_result = *GEGL_RECTANGLE (result->x + i * CHUNK_SIZE,
                                          result->y + j * CHUNK_SIZE,
                                          CHUNK_SIZE, CHUNK_SIZE);

        gegl_rectangle_intersect (&chunked_result, &chunked_result, result);

        if (chunked_result.width < 1  || chunked_result.height < 1)
          continue;

        area = get_required (&boundary, &chunked_result, operation);

        clamp_area (&area, lens.centre_x, lens.centre_y);

        gegl_buffer_get (input, &area, 1.0, babl_format ("RGBA float"), src_buf,
                         GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);

        for (y = chunked_result.y; y < chunked_result.y + chunked_result.height; y++)
          for (x = chunked_result.x; x < chunked_result.x + chunked_result.width; x++)
            {
              lens_distort_func (src_buf, dst_buf, &area, &chunked_result, &boundary,
                                 &lens, x, y, input, background);
            }

        gegl_buffer_set (output, &chunked_result, 0, babl_format ("RGBA float"),
                         dst_buf, GEGL_AUTO_ROWSTRIDE);
      }

  g_free (dst_buf);
  g_free (src_buf);

  return TRUE;
}
Beispiel #5
0
bool manager::conflicts(const elem& elem1, const elem& elem2, bool directonly) const
{
	if (elem1 == elem2) {
		return false;
	}

	// We ignore inexistent elements at this point, they will generate
	// errors in change_era()/change_scenario() anyways.
	if (!exists(elem1) || !exists(elem2)) {
		return false;
	}

	config data1 = depinfo_.find_child(elem1.type, "id", elem1.id);
	config data2 = depinfo_.find_child(elem2.type, "id", elem2.id);

	// Whether we should skip the check entirely
	if (data1.has_attribute("ignore_incompatible_" + elem2.type)) {
		std::vector<std::string> ignored =
						utils::split(data1["ignore_incompatible_" + elem2.type]);

		if ( util::contains(ignored, elem2.id) ) {
			return false;
		}
	}

	if (data2.has_attribute("ignore_incompatible_" + elem1.type)) {
		std::vector<std::string> ignored =
						utils::split(data2["ignore_incompatible_" + elem1.type]);

		if ( util::contains(ignored, elem1.id) ) {
			return false;
		}
	}

	bool result = false;

	// Checking for direct conflicts between elem1 and elem2
	if (data1.has_attribute("allow_" + elem2.type)) {
		std::vector<std::string> allowed =
						utils::split(data1["allow_" + elem2.type]);

		result = !util::contains(allowed, elem2.id) && !requires(elem1, elem2);
	} else if (data1.has_attribute("disallow_" + elem2.type)) {
		std::vector<std::string> disallowed =
						utils::split(data1["disallow_" + elem2.type]);

		result = util::contains(disallowed, elem2.id);
	}

	if (data2.has_attribute("allow_" + elem1.type)) {
		std::vector<std::string> allowed =
						utils::split(data2["allow_" + elem1.type]);

		result = result || (!util::contains(allowed, elem1.id) && !requires(elem2, elem1));
	} else if (data2.has_attribute("disallow_" + elem1.type)) {
		std::vector<std::string> disallowed =
						utils::split(data2["disallow_" + elem1.type]);

		result = result || util::contains(disallowed, elem1.id);
	}

	if (result) {
		return true;
	}

	// Checking for indirect conflicts (i.e. conflicts between dependencies)
	if (!directonly) {
		std::vector<std::string>	req1 = get_required(elem1),
									req2 = get_required(elem2);

		BOOST_FOREACH (const std::string& s, req1) {
			elem m(s, "modification");

			if (conflicts(elem2, m, true)) {
				return true;
			}
		}