- Timestamp:
- Apr 18, 2015, 4:27:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/MapRendering/MapRenderBlockBuffer.cs
r224 r230 53 53 } 54 54 55 public void SetPart (Vector2i offset, int partSize, Color[] pixels) 56 { 55 public void SetPart (Vector2i offset, int partSize, Color[] pixels) { 56 if (offset.x + partSize > blockMap.width || offset.y + partSize > blockMap.height) { 57 Log.Error (string.Format ("MapBlockBuffer[{0}].SetPart ({1}, {2}, {3}) has blockMap.size ({4}/{5})", zoomLevel, offset, partSize, pixels.Length, blockMap.width, blockMap.height)); 58 return; 59 } 57 60 blockMap.SetPixels (offset.x, offset.y, partSize, partSize, pixels); 58 61 } … … 71 74 { 72 75 byte[] array = cache.LoadTile (zoomLevel, _fileName); 73 if (array != null) { 74 blockMap.LoadImage (array); 75 } else { 76 //try { 77 //byte[] array = File.ReadAllBytes (_fileName); 78 //blockMap.LoadImage (array); 79 //} catch (Exception) { 76 if (array == null || !blockMap.LoadImage (array)) { 77 if (blockMap.height != Constants.MAP_BLOCK_SIZE || blockMap.width != Constants.MAP_BLOCK_SIZE) { 78 blockMap.Resize (Constants.MAP_BLOCK_SIZE, Constants.MAP_BLOCK_SIZE); 79 } 80 80 for (int x = 0; x < Constants.MAP_BLOCK_SIZE; x++) { 81 81 for (int y = 0; y < Constants.MAP_BLOCK_SIZE; y++) { … … 86 86 } 87 87 88 private void saveTextureToFile (string _fileName) 89 { 88 private void saveTextureToFile (string _fileName) { 90 89 byte[] array = blockMap.EncodeToPNG (); 91 90 cache.SaveTile (zoomLevel, array); 92 // try {93 // byte[] array = blockMap.EncodeToPNG ();94 // File.WriteAllBytes (_fileName, array);95 // } catch (Exception e) {96 // Log.Out ("Exception in MapRenderBlockBuffer.saveTextureToFile(): " + e);97 // }98 91 } 99 92
Note:
See TracChangeset
for help on using the changeset viewer.