示例#1
0
文件: coherency.c 项目: Jul13t/piglit
static bool
check(const struct grid_info grid, const struct image_info img)
{
        static uint32_t pixels[N][4];

        return download_result(grid, pixels[0]) &&
                check_pixels(img, pixels[0], 33, 33, 33, 33);
}
示例#2
0
文件: unused.c 项目: Jul13t/piglit
static bool
check(const struct image_info img, uint32_t v)
{
        uint32_t pixels[N];

        return download_image(img, 0, pixels) &&
                check_pixels(img, pixels, v, 0, 0, 0);
}
示例#3
0
文件: atomicity.c 项目: Jul13t/piglit
static bool
check_image_const(const struct image_info img, unsigned n, uint32_t v)
{
        uint32_t pixels[N];

        return download_image(img, 0, pixels) &&
                check_pixels(set_image_size(img, n, 1, 1, 1),
                             pixels, v, 0, 0, 0);
}
示例#4
0
void draw_child(skiatest::Reporter* reporter,
                const sk_gpu_test::ContextInfo& childInfo,
                const GrBackendTexture& backendTexture,
                const GrBackendSemaphore& semaphore) {

    childInfo.testContext()->makeCurrent();

    const SkImageInfo childII = SkImageInfo::Make(CHILD_W, CHILD_H, kRGBA_8888_SkColorType,
                                                  kPremul_SkAlphaType);

    GrContext* childCtx = childInfo.grContext();
    sk_sp<SkSurface> childSurface(SkSurface::MakeRenderTarget(childCtx, SkBudgeted::kNo,
                                                              childII, 0, kTopLeft_GrSurfaceOrigin,
                                                              nullptr));

    sk_sp<SkImage> childImage = SkImage::MakeFromTexture(childCtx,
                                                         backendTexture,
                                                         kTopLeft_GrSurfaceOrigin,
                                                         kRGBA_8888_SkColorType,
                                                         kPremul_SkAlphaType,
                                                         nullptr,
                                                         nullptr,
                                                         nullptr);

    SkCanvas* childCanvas = childSurface->getCanvas();
    childCanvas->clear(SK_ColorRED);

    childSurface->wait(1, &semaphore);

    childCanvas->drawImage(childImage, CHILD_W/2, 0);

    SkPaint paint;
    paint.setColor(SK_ColorGREEN);
    SkIRect rect = SkIRect::MakeLTRB(0, CHILD_H/2, CHILD_W, CHILD_H);
    childCanvas->drawIRect(rect, paint);

    // read pixels
    SkBitmap bitmap;
    bitmap.allocPixels(childII);
    childSurface->readPixels(bitmap, 0, 0);

    check_pixels(reporter, bitmap);
}
示例#5
0
void manip_check_diffs(unsigned char *image, int *xp, int *yp, int *xp2, int *yp2)
{
	static unsigned char *last_image = NULL;
	if(last_image == NULL)
	{
		*xp = -1;
		*yp = -1;
		*xp2 = -1;
		*yp2 = -1;
		//The resolution of motion detection is half of what the actual image size is (I doubt highly we wanna check if a fly is in the room etc)
		last_image = malloc(320*3*240); 
		copy_image_scaled(last_image, image);
		
	}
	unsigned char *current_image = malloc(320*240*3);
	copy_image_scaled(current_image, image);

	*xp = -1;
	*yp = -1;
	*xp2 = -1;
	*yp2 = -1;
	
	int y = 0;
	int x = 0;
	for(y = 0; y<240;y++)
	{
		for(x = 0; x < 320; x++)
		{
			//Check the 3 pixels
			if(check_pixels(current_image, last_image, x*3,y,16))
			{
				if(check_pixels(current_image, last_image, x*3+1,y,16))
				{
					if(check_pixels(current_image, last_image, x*3+2,y,16))
					{
						if(*xp==-1) // not been set yet
						{
							*xp = x;
							*xp2 = x;
							*yp = y;
							*yp2 = y;
						}
						if(*xp>x)
							*xp = x;
						else if(*xp2<x)
							*xp2 = x;
						if(*yp>y)
							*yp = y;
						else if(*yp2<y)
							*yp2 = y;
					}		
				}
			}
		}
	}
	*xp*=2;
	*yp*=2;
	*xp2*=2;
	*yp2*=2;
	copy_image_scaled(last_image, image);
	free(current_image);
}