예제 #1
0
Rect intersection(const Rect& r1, const Rect& r2){
  const auto tl = max_coords(r1.TopLeft(), r2.TopLeft());
  const auto br = min_coords(r1.BottomRight(), r2.BottomRight());
  return br.x < tl.x || br.y < tl.y ?
    Rect() :
    Rect(tl, br);
}
예제 #2
0
	CUGIP_DECL_DEVICE
	void load(TView aView, coord_t aCorner/*region<cDimension> aRegion*/)
	{
		int index = threadOrderFromIndex();
		TElement *buffer = reinterpret_cast<TElement *>(data);
		while (index < cElementCount) {
			auto coords = min_coords(
				aView.dimensions()-coord_t(1, FillFlag()),
				max_coords(coord_t(),
					aCorner + index_from_linear_access_index(to_vector(TStaticSize()), index)));
			buffer[index] = aView[coords];

			index += TThreadBlockSize::count();
		}
	}
예제 #3
0
	CUGIP_DECL_DEVICE
	void shift_and_load(TView aView, coord_t aCorner, int aShift) {
		shift_up2(aShift);

		int layerCount = TStaticSize::last() - aShift;
		int index = layerCount * cLayerSize + threadOrderFromIndex();
		TElement *buffer = reinterpret_cast<TElement *>(data);
		while (index < cElementCount) {
			auto coords = min_coords(
				aView.dimensions()-coord_t(1, FillFlag()),
				max_coords(coord_t(),
					aCorner + index_from_linear_access_index(TStaticSize::vector(), index)));
			buffer[index] = aView[coords];

			index += TThreadBlockSize::count();
		}
	}