MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / startRecorderScreenShot

Method startRecorderScreenShot

platform/sdl/knativescreenSDL.cpp:372–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370#ifdef BOXEDWINE_RECORDER
371
372void KNativeScreenSDL::startRecorderScreenShot() {
373 BOXEDWINE_MUTEX_LOCK(drawingMutex);
374 SDL_Surface* src = SDL_GetWindowSurface(window);
375 SDL_Rect r = {};
376
377 r.x = 0;
378 r.y = 0;
379 r.w = src->w;
380 r.h = src->h;
381
382 screenCopyTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, src->w, src->h);
383 U32 len = src->w * src->h * src->format->BytesPerPixel;
384 U8* pixels = new unsigned char[len];
385
386 if (!SDL_RenderReadPixels(renderer, &src->clip_rect, src->format->format, pixels, src->w * src->format->BytesPerPixel)) {
387 SDL_UpdateTexture(screenCopyTexture, nullptr, pixels, src->w * src->format->BytesPerPixel);
388 }
389 delete[] pixels;
390}
391
392void KNativeScreenSDL::finishRecorderScreenShot() {
393 SDL_Surface* dst = SDL_GetWindowSurface(window);

Callers 1

takeScreenShotMethod · 0.80

Calls 4

SDL_GetWindowSurfaceFunction · 0.85
SDL_CreateTextureFunction · 0.85
SDL_RenderReadPixelsFunction · 0.85
SDL_UpdateTextureFunction · 0.85

Tested by

no test coverage detected