Skip to content

Commit

Permalink
Put wallpaper through linear workflow.
Browse files Browse the repository at this point in the history
Without this wallpapers could turn up
with wrong gamma applied.

#RH-34959 Needs Testing
#RH-34959 Assigned to: brianjames
#RH-34959 add Worked on By nathan
  • Loading branch information
jesterKing committed Aug 9, 2016
1 parent c7eb81e commit 910b3da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Converters/BitmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public static void EnvironmentBitmapFromEvaluator(RenderEnvironment rm, CyclesTe
}
}

public static byte[] ReadByteBitmapFromBitmap(int pwidth, int pheight, Bitmap bm)
public static ByteBitmap ReadByteBitmapFromBitmap(uint id, int pwidth, int pheight, Bitmap bm)
{
var upixel = new byte[pwidth * pheight * 4];

Expand All @@ -269,7 +269,7 @@ public static byte[] ReadByteBitmapFromBitmap(int pwidth, int pheight, Bitmap bm
upixel[offset + 3] = px.A;
}
}
return upixel;
return new ByteBitmap(id, upixel, pwidth, pheight);
}

private static byte[] ReadByteBitmapFromEvaluator(int pwidth, int pheight, TextureEvaluator textureEvaluator, bool isEnvironment, bool planarProjection)
Expand Down
8 changes: 5 additions & 3 deletions CyclesBackground.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ public void HandleWallpaper(ViewInfo view, bool scaleToFit)
wallpaper.Clear();
return;
}

m_old_wallpaper = view.WallpaperFilename != null ? view.WallpaperFilename : "";

var crc = Rhino.RhinoMath.CRC32(27, System.Text.Encoding.UTF8.GetBytes(m_old_wallpaper));
try
{
int near, far;
Expand Down Expand Up @@ -238,7 +237,10 @@ public void HandleWallpaper(ViewInfo view, bool scaleToFit)
var tmpf = string.Format("{0}\\{1}.png", Environment.GetEnvironmentVariable("TEMP"), "RC_wallpaper");
newBitmap.Save(tmpf, ImageFormat.Png);
#endif
wallpaper.TexByte = BitmapConverter.ReadByteBitmapFromBitmap(newBitmap.Size.Width, newBitmap.Size.Height, newBitmap);
var wallpaperbm = BitmapConverter.ReadByteBitmapFromBitmap(crc, newBitmap.Size.Width, newBitmap.Size.Height, newBitmap);
wallpaperbm.ApplyGamma(gamma);
wallpaper.TexByte = wallpaperbm.corrected;
wallpaperbm.SaveBitmaps();
wallpaper.TexWidth = newBitmap.Width;
wallpaper.TexHeight = newBitmap.Height;
wallpaper.Name = string.Format("{0}_{1}x{2}_{3}_{4}_{5}_{6}",
Expand Down

0 comments on commit 910b3da

Please sign in to comment.