Advertisement
Guest User

sepia-looks-awful.patch

a guest
Jul 31st, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.29 KB | None | 0 0
  1. diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp
  2. index e188928833..eabffcd0db 100644
  3. --- a/src/cata_tiles.cpp
  4. +++ b/src/cata_tiles.cpp
  5. @@ -363,13 +363,13 @@ void tileset_loader::create_textures_from_tile_atlas( const SDL_Surface_Ptr &til
  6.      copy_surface_to_texture( tile_atlas, offset, ts.tile_values );
  7.  
  8.      /** perform color filter conversion here */
  9. -    copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_grayscale ), offset,
  10. +    copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_memorized ), offset,
  11.                               ts.shadow_tile_values );
  12.      copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_nightvision ), offset,
  13.                               ts.night_tile_values );
  14.      copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_overexposed ), offset,
  15.                               ts.overexposed_tile_values );
  16. -    copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_memorized ), offset,
  17. +    copy_surface_to_texture( apply_color_filter( tile_atlas, color_pixel_grayscale ), offset,
  18.                               ts.memory_tile_values );
  19.  }
  20.  
  21. diff --git a/src/sdl_utils.h b/src/sdl_utils.h
  22. index b2e9f4a3d3..6fe2fea748 100644
  23. --- a/src/sdl_utils.h
  24. +++ b/src/sdl_utils.h
  25. @@ -102,21 +102,12 @@ inline SDL_Color color_pixel_memorized( const SDL_Color &color )
  26.          return color;
  27.      }
  28.  
  29. -    /*
  30. -     *  Objective is to provide a gradient between two color points
  31. -     *  (sepia_dark and sepia_light) based on the grayscale value.
  32. -     *  This presents an effect intended to mimic a faded sepia photograph.
  33. -     */
  34. -
  35. -    const SDL_Color sepia_dark = { 39, 23, 19, color.a};
  36. -    const SDL_Color sepia_light = { 241, 220, 163, color.a};
  37. -
  38. -    const Uint8 av = average_pixel_color( color );
  39. -    const float gammav = 1.6;
  40. -    const float pv = av / 255.0;
  41. -    const Uint8 finalv = std::min( int( round( pow( pv, gammav ) * 150 ) ), 100 );
  42. -
  43. -    return mix_colors( sepia_dark, sepia_light, finalv );
  44. +    return {
  45. +         std::max<Uint8>( 85 * color.r >> 8, 0x01 ),
  46. +         std::max<Uint8>( 85 * color.g >> 8, 0x01 ),
  47. +         std::max<Uint8>( 85 * color.b >> 8, 0x01 ),
  48. +         color.a
  49. +     };
  50.  }
  51.  
  52.  SDL_Color curses_color_to_SDL( const nc_color &color );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement