<commit_before>﻿using System;
using Nez.Systems;
using Nez.Textures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Nez;


namespace MacTester
{
	public class PixelBloomPostProcessor : BloomPostProcessor
	{
		RenderTexture _layerRT;
		RenderTexture _tempRT;


		public PixelBloomPostProcessor( NezContentManager contentManager, RenderTexture layerRenderTexture ) : base( contentManager )
		{
			_layerRT = layerRenderTexture;
		}


		public override void onSceneBackBufferSizeChanged( int newWidth, int newHeight )
		{
			base.onSceneBackBufferSizeChanged( newWidth, newHeight );

			_tempRT = new RenderTexture( newHeight, newWidth );
		}


		public override void process( RenderTexture source, RenderTexture destination )
		{
			// first we process the rendered layer with the bloom effect
			base.process( _layerRT, _tempRT );

			// we need to be careful here and ensure we use AlphaBlending since the layer we rendered is mostly transparent
			Core.graphicsDevice.SetRenderTarget( destination );<commit_msg>fixed leaking RenderTarget2D<commit_after>﻿using System;
using Nez.Systems;
using Nez.Textures;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Nez;


namespace MacTester
{
	public class PixelBloomPostProcessor : BloomPostProcessor
	{
		RenderTexture _layerRT;
		RenderTexture _tempRT;


		public PixelBloomPostProcessor( NezContentManager contentManager, RenderTexture layerRenderTexture ) : base( contentManager )
		{
			_layerRT = layerRenderTexture;
			_tempRT = new RenderTexture( newHeight, newWidth );
		}


		public override void onSceneBackBufferSizeChanged( int newWidth, int newHeight )
		{
			base.onSceneBackBufferSizeChanged( newWidth, newHeight );

			_tempRT.resize( newHeight, newWidth );
		}


		public override void process( RenderTexture source, RenderTexture destination )
		{
			// first we process the rendered layer with the bloom effect
			base.process( _layerRT, _tempRT );

			// we need to be careful here and ensure we use AlphaBlending since the layer we rendered is mostly transparent
			Core.graphicsDevice.SetRenderTarget( destination );
{'fraction_non_alphanumeric': 0.06305464736104624, 'fraction_numerical': 0.00046707146193367583, 'mean_word_length': 4.836512261580381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6950960', 'n_tokens_mistral': 651, 'n_tokens_neox': 590, 'n_words': 185}