diff --git a/src/android/i_video.c b/src/android/i_video.c index bbe1cf3a3..23c06dfb2 100644 --- a/src/android/i_video.c +++ b/src/android/i_video.c @@ -65,7 +65,7 @@ void I_WaitVBL(INT32 count) (void)count; } -void I_ReadScreen(UINT8 *scr) +void I_ReadScreen(UINT8 * restrict scr, INT32 scale) { (void)scr; } diff --git a/src/dedicated/i_video.c b/src/dedicated/i_video.c index 7a1239507..c67d8cefd 100644 --- a/src/dedicated/i_video.c +++ b/src/dedicated/i_video.c @@ -89,9 +89,10 @@ void I_UpdateNoVsync(void) // // I_ReadScreen // -void I_ReadScreen(UINT8 *scr) +void I_ReadScreen(UINT8 * restrict scr, INT32 scale) { (void)scr; + (void)scale; } // diff --git a/src/f_wipe.c b/src/f_wipe.c index cbb411b8b..4c3a067c6 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -314,7 +314,7 @@ void F_WipeStartScreen(void) } #endif wipe_scr_start = vid.screens[3]; - I_ReadScreen(wipe_scr_start); + I_ReadScreen(wipe_scr_start, 1); #endif } @@ -331,7 +331,7 @@ void F_WipeEndScreen(void) } #endif wipe_scr_end = vid.screens[4]; - I_ReadScreen(wipe_scr_end); + I_ReadScreen(wipe_scr_end, 1); V_DrawBlock(0, 0, 0, vid.width, vid.height, wipe_scr_start); #endif } diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index a8a2bdfda..e77d83b3b 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -23,7 +23,6 @@ #include "hw_glob.h" #include "hw_gl.h" -#include "../m_misc.h" //FIL_WriteFile() #include "../r_draw.h" //viewborderlump #include "../r_main.h" #include "../w_wad.h" @@ -1214,42 +1213,17 @@ static inline boolean saveTGA(const char *file_name, void *buffer, // -------------------------------------------------------------------------- // screen shot // -------------------------------------------------------------------------- - -UINT8 *HWR_GetScreenshot(void) +UINT8 *HWR_GetScreenshot(INT32 scale) { static UINT8 *buf = NULL; - buf = realloc(buf, vid.width * vid.height * 3); + buf = realloc(buf, (vid.width/scale)*(vid.height/scale)*3); if (!buf) return NULL; - // returns 24bit 888 RGB - GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf); + GL_ReadScreenFinalTexture(buf, scale); return buf; } -boolean HWR_Screenshot(const char *pathname) -{ - boolean ret; - UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf)); - - if (!buf) - { - CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n"); - return false; - } - - // returns 24bit 888 RGB - GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf); - -#ifdef USE_PNG - ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL); -#else - ret = saveTGA(pathname, buf, vid.width, vid.height); -#endif - free(buf); - return ret; -} - #endif //HWRENDER diff --git a/src/hardware/hw_gl.h b/src/hardware/hw_gl.h index 8780fc57b..8c3da0768 100644 --- a/src/hardware/hw_gl.h +++ b/src/hardware/hw_gl.h @@ -55,6 +55,7 @@ INT32 GL_GetTextureUsed(void); void GL_CreateModelVBOs(model_t *model); void GL_ReadScreenTexture(int tex, UINT16 *dst_data); +void GL_ReadScreenFinalTexture(UINT8 * restrict dest, INT32 scale); void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip); void GL_MakeScreenTexture(int tex); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 14ab66522..4060b6540 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -101,8 +101,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height); void HWR_DrawViewBorder(INT32 clearlines); void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum); -UINT8 *HWR_GetScreenshot(void); -boolean HWR_Screenshot(const char *lbmname); +UINT8 *HWR_GetScreenshot(INT32 scale); // hw_main.c void HWR_SetViewSize(void); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 5bd9268ad..7a4f7e8c3 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -25,9 +25,6 @@ // Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c -// requires GL 4.3 -//#define GLDEBUGMESSAGE - #if defined (HWRENDER) && !defined (NOROPENGL) #include "../../r_fps.h" // For R_GetTimeFrac, used for the leveltime shader uniform @@ -41,6 +38,8 @@ #include "../../i_video.h" +// requires GL 4.3 +//#define GLDEBUGMESSAGE #ifdef GLDEBUGMESSAGE #include "../../console.h" #endif @@ -342,6 +341,7 @@ static void GL_MSG_Error(const char *format, ...) /* Raster functions */ #define pglPixelStorei glPixelStorei #define pglReadPixels glReadPixels +#define pglGetTexImage glGetTexImage /* Texture mapping */ #define pglTexEnvi glTexEnvi @@ -455,6 +455,8 @@ typedef void (APIENTRY * PFNglPixelStorei) (GLenum pname, GLint param); static PFNglPixelStorei pglPixelStorei; typedef void (APIENTRY * PFNglReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); static PFNglReadPixels pglReadPixels; +typedef void (APIENTRY * PFNglGetTexImage) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +static PFNglGetTexImage pglGetTexImage; /* Texture mapping */ typedef void (APIENTRY * PFNglTexEnvi) (GLenum target, GLenum pname, GLint param); @@ -651,6 +653,7 @@ boolean SetupGLfunc(void) GetGLfunc(glPixelStorei) GetGLfunc(glReadPixels) + GetGLfunc(glGetTexImage) GetGLfunc(glTexEnvi) GetGLfunc(glTexParameteri) @@ -1489,6 +1492,54 @@ void GL_ReadScreenTexture(int tex, UINT16 *dst_data) free(row); } +// nope, definitely not faster. software has the same flickering/z-fighting bugs with laggy GIF recording anyway +//#define GETTEXIMAGE + +#ifdef GETTEXIMAGE +#define TEXWIDTH screen_texsizew +#else +#define TEXWIDTH screen_width +#endif + +// -----------------------+ +// ReadScreenFinalTexture : Reads out the final screen texture +// Returns : 24bit RGB pixel array stored in dest +// -----------------------+ +void GL_ReadScreenFinalTexture(UINT8 * restrict dest, INT32 scale) +{ + const INT32 stride = (screen_width/scale)*3; + INT32 scanlines = screen_height; + GLubyte * restrict image; + +#ifdef GETTEXIMAGE + image = malloc(screen_texsizew*screen_texsizeh*3); // oof + pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_GENERIC2]); + pglGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, image); + tex_downloaded = screenTextures[HWD_SCREENTEXTURE_GENERIC2]; +#else + image = malloc(screen_width*screen_height*3); + pglPixelStorei(GL_PACK_ALIGNMENT, 1); + pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, image); +#endif + + // TODO the downscaling happens in the screen capture code now, + // yet we're still doing this on the CPU? sheesh... + // this is where actual knowledge of OpenGL would've come in handy + image += scanlines*TEXWIDTH*3; + while ((scanlines -= scale) >= 0) + { + image -= TEXWIDTH*scale*3; + if (scale == 1) + memcpy(dest, image, stride); + else for (size_t i = 0; i < stride; i += 3) + memcpy(dest + i, image + i*scale, 3); + dest += stride; + } + + // ...yet still, restrict doesn't make the inner loop any faster + free(image - ((screen_height % scale) * TEXWIDTH*3)); +} + // -----------------+ // SetPalette : Changes the current texture palette // -----------------+ diff --git a/src/i_video.h b/src/i_video.h index 7850d664a..0bf6c3af0 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -126,7 +126,7 @@ void I_WaitVBL(INT32 count); \return void */ -void I_ReadScreen(UINT8 *scr); +void I_ReadScreen(UINT8 * restrict scr, INT32 scale); /** \brief Start disk icon */ diff --git a/src/m_anigif.c b/src/m_anigif.c index 626b8ef66..78e7cf12c 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -49,6 +49,14 @@ static precise_t gif_prevframetime = 0; static UINT32 gif_delayus = 0; // "us" is microseconds static UINT8 gif_writeover = 0; +// SCReen BUFfer (obviously) +// --- +static UINT8 *scrbuf_pos; +static UINT8 *scrbuf_linebegin; +static UINT8 *scrbuf_lineend; +static UINT8 *scrbuf_writeend; +static INT16 scrbuf_downscaleamt = 1; +static UINT16 scrbuf_width, scrbuf_height; // OPTIMIZE gif output // --- @@ -63,13 +71,13 @@ static UINT8 gif_writeover = 0; static UINT8 GIF_optimizecmprow(const UINT8 *dst, const UINT8 *src, INT32 row, INT32 *last, INT32 *left, INT32 *right) { - const UINT8 *dp = dst + (vid.width * row); - const UINT8 *sp = src + (vid.width * row); + const UINT8 *dp = dst + (scrbuf_width * row); + const UINT8 *sp = src + (scrbuf_width * row); const UINT8 *dtmp, *stmp; UINT8 doleft = 1, doright = 1; INT32 i = 0; - if (!memcmp(sp, dp, vid.width)) + if (!memcmp(sp, dp, scrbuf_width)) return 0; // unchanged. *last = row; @@ -96,14 +104,14 @@ static UINT8 GIF_optimizecmprow(const UINT8 *dst, const UINT8 *src, INT32 row, } // right side - i = vid.width - 1; - if (*right == vid.width - 1) // edge reached + i = scrbuf_width - 1; + if (*right == scrbuf_width - 1) // edge reached doright = 0; else if (*right >= 0) // right set, non-end-of-width { dtmp = dp + *right + 1; stmp = sp + *right + 1; - if (!memcmp(stmp, dtmp, vid.width - (*right + 1))) + if (!memcmp(stmp, dtmp, scrbuf_width - (*right + 1))) doright = 0; // right side not changed } while (doright) @@ -133,7 +141,7 @@ static UINT8 GIF_optimizecmprow(const UINT8 *dst, const UINT8 *src, INT32 row, static void GIF_optimizeregion(const UINT8 *dst, const UINT8 *src, INT32 *x, INT32 *y, INT32 *w, INT32 *h) { - INT32 st = 0, sb = vid.height - 1; // work from both directions + INT32 st = 0, sb = scrbuf_height - 1; // work from both directions INT32 firstchg_t = -1, firstchg_b = -1; // store first changed row. INT32 lastchg_t = -1, lastchg_b = -1; // Store last row... just in case INT32 lmpix = -1, rmpix = -1; // store left and rightmost change @@ -144,7 +152,7 @@ static void GIF_optimizeregion(const UINT8 *dst, const UINT8 *src, if (!stopt) { if (GIF_optimizecmprow(dst, src, st++, &lastchg_t, &lmpix, &rmpix) - && lmpix == 0 && rmpix == vid.width - 1) + && lmpix == 0 && rmpix == scrbuf_width - 1) stopt = 1; if (firstchg_t < 0 && lastchg_t >= 0) firstchg_t = lastchg_t; @@ -152,7 +160,7 @@ static void GIF_optimizeregion(const UINT8 *dst, const UINT8 *src, if (!stopb) { if (GIF_optimizecmprow(dst, src, sb--, &lastchg_b, &lmpix, &rmpix) - && lmpix == 0 && rmpix == vid.width - 1) + && lmpix == 0 && rmpix == scrbuf_width - 1) stopb = 1; if (firstchg_b < 0 && lastchg_b >= 0) firstchg_b = lastchg_b; @@ -222,18 +230,6 @@ static void GIF_bwrwrite(UINT32 idata) } } - - -// SCReen BUFfer (obviously) -// --- -static UINT8 *scrbuf_pos; -static UINT8 *scrbuf_linebegin; -static UINT8 *scrbuf_lineend; -static UINT8 *scrbuf_writeend; -static INT16 scrbuf_downscaleamt = 1; - - - // GIF LZW algorithm // --- #define GIFLZW_TABLECLR 0x100 @@ -359,12 +355,14 @@ static void GIF_lzw(void) GIF_bwrwrite(GIFLZW_TABLECLR); GIF_prepareLZW(); } - if ((scrbuf_pos += scrbuf_downscaleamt) >= scrbuf_lineend) + + if (++scrbuf_pos >= scrbuf_lineend) { - scrbuf_lineend += (vid.width * scrbuf_downscaleamt); - scrbuf_linebegin += (vid.width * scrbuf_downscaleamt); + scrbuf_lineend += scrbuf_width; + scrbuf_linebegin += scrbuf_width; scrbuf_pos = scrbuf_linebegin; } + // Just a bit of overflow prevention if (gifbwr_bufsize >= 248) break; @@ -413,7 +411,6 @@ static void GIF_headwrite(void) UINT8 *p = gifhead; RGBA_t *c; INT32 i; - UINT16 rwidth, rheight; if (!gif_out) return; @@ -424,17 +421,18 @@ static void GIF_headwrite(void) if (gif_downscale) { scrbuf_downscaleamt = vid.dupx; - rwidth = (vid.width / scrbuf_downscaleamt); - rheight = (vid.height / scrbuf_downscaleamt); + scrbuf_width = (vid.width / scrbuf_downscaleamt); + scrbuf_height = (vid.height / scrbuf_downscaleamt); } else { scrbuf_downscaleamt = 1; - rwidth = vid.width; - rheight = vid.height; + scrbuf_width = vid.width; + scrbuf_height = vid.height; } - WRITEUINT16(p, rwidth); - WRITEUINT16(p, rheight); + + WRITEUINT16(p, scrbuf_width); + WRITEUINT16(p, scrbuf_height); // colors, aspect, etc WRITEUINT8(p, 0xF7); @@ -475,26 +473,16 @@ static size_t gifframe_size = 8192; #ifdef HWRENDER static colorlookup_t gif_colorlookup; -static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr) +static void GIF_rgbconvert(UINT8 * restrict linear, UINT8 * restrict scr) { - UINT8 r, g, b; - size_t src, dest; - int x, y; - InitColorLUT(&gif_colorlookup, gif_palette, true); - for (x = 0; x < vid.width; x += scrbuf_downscaleamt) + for (INT32 i = 0; i < scrbuf_width*scrbuf_height; i++) { - for (y = 0; y < vid.height; y += scrbuf_downscaleamt) - { - dest = y*vid.width + x; - src = dest*3; - - r = (UINT8)linear[src]; - g = (UINT8)linear[src + 1]; - b = (UINT8)linear[src + 2]; - scr[dest] = GetColorLUTDirect(&gif_colorlookup, r, g, b); - } + UINT8 r = *linear++; + UINT8 g = *linear++; + UINT8 b = *linear++; + *scr++ = GetColorLUTDirect(&gif_colorlookup, r, g, b); } } #endif @@ -506,6 +494,7 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr) static void GIF_framewrite(void) { UINT8 *p; + UINT8 *base_screen = vid.screens[0]; UINT8 *movie_screen = vid.screens[2]; INT32 blitx, blity, blitw, blith; @@ -516,47 +505,31 @@ static void GIF_framewrite(void) if (!gif_out) return; + // blit to temp screen + if (rendermode == render_soft) + I_ReadScreen(movie_screen, scrbuf_downscaleamt); +#ifdef HWRENDER + else if (rendermode == render_opengl) + { + // save previous frame (software already does this elsewhere...?) + memcpy(base_screen, movie_screen, scrbuf_width * scrbuf_height); + + UINT8 *linear = HWR_GetScreenshot(scrbuf_downscaleamt); + GIF_rgbconvert(linear, movie_screen); + //free(linear); // Allocated 'statically', no need to free now + } +#endif + // Compare image data (for optimizing GIF) if (gif_optimize && gif_frames > 0) { - // before blit movie_screen points to last frame, cur_screen points to this frame - UINT8 *cur_screen = vid.screens[0]; - GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith); - - // blit to temp screen - if (rendermode == render_soft) - I_ReadScreen(movie_screen); -#ifdef HWRENDER - else if (rendermode == render_opengl) - { - UINT8 *linear = HWR_GetScreenshot(); - GIF_rgbconvert(linear, movie_screen); - //free(linear); // Allocated 'statically', no need to free now - } -#endif + GIF_optimizeregion(base_screen, movie_screen, &blitx, &blity, &blitw, &blith); } else { blitx = blity = 0; - blitw = vid.width; - blith = vid.height; - -#ifdef HWRENDER - // Copy the current OpenGL frame into the base screen - if (rendermode == render_opengl) - { - UINT8 *linear = HWR_GetScreenshot(); - GIF_rgbconvert(linear, vid.screens[0]); - //free(linear); // Allocated 'statically', no need to free now - } -#endif - - // Copy the first frame into the movie screen - // OpenGL already does the same above. - if (gif_frames == 0 && rendermode == render_soft) - I_ReadScreen(movie_screen); - - movie_screen = vid.screens[0]; + blitw = scrbuf_width; + blith = scrbuf_height; } // screen regions are handled in GIF_lzw @@ -564,7 +537,7 @@ static void GIF_framewrite(void) UINT16 delay = 0; INT32 startline; - if (gif_dynamicdelay ==(UINT8) 2) + if (gif_dynamicdelay ==(UINT8) 2) { // golden's attempt at creating a "dynamic delay" UINT16 mingifdelay = 10; // minimum gif delay in milliseconds (keep at 10 because gifs can't get more precise). @@ -600,24 +573,17 @@ static void GIF_framewrite(void) WRITEUINT8(p, 0); WRITEUINT8(p, 0); // end of GCE - if (scrbuf_downscaleamt > 1) - { - // Ensure our downscaled blitx/y starts and ends on a pixel. - blitx -= (blitx % scrbuf_downscaleamt); - blity -= (blity % scrbuf_downscaleamt); - blitw = ((blitw + (scrbuf_downscaleamt - 1)) / scrbuf_downscaleamt) * scrbuf_downscaleamt; - blith = ((blith + (scrbuf_downscaleamt - 1)) / scrbuf_downscaleamt) * scrbuf_downscaleamt; - } - WRITEUINT8(p, 0x2C); - WRITEUINT16(p, (UINT16)(blitx / scrbuf_downscaleamt)); - WRITEUINT16(p, (UINT16)(blity / scrbuf_downscaleamt)); - WRITEUINT16(p, (UINT16)(blitw / scrbuf_downscaleamt)); - WRITEUINT16(p, (UINT16)(blith / scrbuf_downscaleamt)); + + WRITEUINT16(p, (UINT16)blitx); + WRITEUINT16(p, (UINT16)blity); + WRITEUINT16(p, (UINT16)blitw); + WRITEUINT16(p, (UINT16)blith); + WRITEUINT8(p, 0); // no local table of colors - scrbuf_pos = movie_screen + blitx + (blity * vid.width); - scrbuf_writeend = scrbuf_pos + (blitw - 1) + ((blith - 1) * vid.width); + scrbuf_pos = movie_screen + blitx + (blity * scrbuf_width); + scrbuf_writeend = scrbuf_pos + (blitw - 1) + ((blith - 1) * scrbuf_width); if (!gifbwr_buf) gifbwr_buf = Z_Malloc(256, PU_STATIC, NULL); @@ -627,8 +593,8 @@ static void GIF_framewrite(void) giflzw_workingCode = UINT16_MAX; WRITEUINT8(p, gifbwr_bits_min - 1); - startline = (scrbuf_pos - movie_screen) / vid.width; - scrbuf_linebegin = movie_screen + (startline * vid.width) + blitx; + startline = (scrbuf_pos - movie_screen) / scrbuf_width; + scrbuf_linebegin = movie_screen + (startline * scrbuf_width) + blitx; scrbuf_lineend = scrbuf_linebegin + blitw; //prewrite a table clear @@ -658,7 +624,7 @@ static void GIF_framewrite(void) } fwrite(gifframe_data, 1, (p - gifframe_data), gif_out); ++gif_frames; - gif_prevframetime = I_GetPreciseTime(); + gif_prevframetime = I_GetPreciseTime(); } diff --git a/src/m_misc.c b/src/m_misc.c index d43a7bb5c..c59b10a6a 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1240,7 +1240,7 @@ void M_SaveFrame(void) { // munge planar buffer to linear linear = vid.screens[2]; - I_ReadScreen(linear); + I_ReadScreen(linear, 1); } #ifdef HWRENDER else @@ -1506,6 +1506,7 @@ void M_DoScreenShot(void) char pathname[MAX_WADPATH]; boolean ret = false; UINT8 *linear = NULL; + UINT8 *palette; // Don't take multiple screenshots, obviously takescreenshot = false; @@ -1538,30 +1539,30 @@ void M_DoScreenShot(void) freename = Newsnapshotfile(pathname,"tga"); #endif + if (!freename) + goto failure; + if (rendermode == render_soft) { // munge planar buffer to linear linear = vid.screens[2]; - I_ReadScreen(linear); - } - - if (!freename) - goto failure; - - // save the pcx file -#ifdef HWRENDER - if (rendermode == render_opengl) - ret = HWR_Screenshot(va(pandf,pathname,freename)); - else -#endif - { + I_ReadScreen(linear, 1); M_CreateScreenShotPalette(); -#ifdef USE_PNG - ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette); -#else - ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette); -#endif + palette = screenshot_palette; } +#ifdef HWRENDER + else if (rendermode == render_opengl) + { + linear = HWR_GetScreenshot(1); + palette = NULL; + } +#endif + +#ifdef USE_PNG + ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, palette); +#else + ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, palette); +#endif failure: if (ret) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 6fcf51be9..96d22355a 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1410,12 +1410,22 @@ void I_UpdateNoVsync(void) // // I_ReadScreen // -void I_ReadScreen(UINT8 *scr) +void I_ReadScreen(UINT8 * restrict scr, INT32 scale) { if (rendermode != render_soft) I_Error ("I_ReadScreen: called while in non-software mode"); - else + else if (scale == 1) VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.rowbytes, vid.rowbytes); + else + { + UINT8 * restrict source = vid.screens[0]; + INT32 w = vid.width/scale*scale, h = vid.height/scale*scale; + + // size_t saves a lea + movsxd over INT32. mind your types! + for (size_t y = 0; y < h; y += scale) + for (size_t x = 0; x < w; x += scale) + *scr++ = source[y*vid.width + x]; + } } //