Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. void SimpleGuiDX11::applyGamma(float gamma) {
  2.     if (lastGamma == gamma) return;
  3.    
  4.     lastGamma = gamma;
  5.     {
  6.         std::lock_guard<std::mutex> lock(tex_data_lock_);
  7.        
  8.         for (int y = 0; y < height_; ++y)
  9.         {
  10.             for (int x = 0; x < width_; ++x)
  11.             {
  12.                 const int offset = (y * width_ + x) * 4;
  13.  
  14.                 tex_data_[offset] = pow(raw_tex_data_[offset], gamma);
  15.                 tex_data_[offset + 1] = pow(raw_tex_data_[offset + 1], gamma);
  16.                 tex_data_[offset + 2] = pow(raw_tex_data_[offset + 2], gamma);
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement