<commit_before>/*
* Copyright (C) 2014 - <NAME> <<EMAIL>>
*
* This sofware is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with This software. If not, see <http://www.gnu.org/licenses/>.
*/

use ooc-math
use ooc-draw
use ooc-draw-gpu
import OpenGLES3/Texture, OpenGLES3Canvas, OpenGLES3Map

OpenGLES3Monochrome: class extends GpuMonochrome {
	backend: Texture { get { this _backend as Texture } }
	init: func (size: IntSize2D, context: GpuContext) {
		init(size, size width, null, context)
	}
	init: func ~fromPixels (size: IntSize2D, stride: UInt, data: Pointer, context: GpuContext) {
		super(size, context)
		this _backend = Texture create(TextureType monochrome, size width, size height, stride, data) as Pointer
	}
	init: func ~fromTexture (texture: Texture, size: IntSize2D, context: GpuContext) {
		super(size, context)
		this _backend = texture
	}
	bind: func (unit: UInt) {
		this backend bind(unit)
	}
	unbind: func {
		this backend unbind()
	}
	dispose: func {
		this backend dispose()
		if (this _canvas != null)
			this _canvas dispose()
	}
	upload: func (raster: RasterImage) {
		this backend uploadPixels(raster pointer, raster stride)
	}
	setFilter: func (filter: Bool) {
		this backend setFilter(filter)
	}
	generateMipmap: func {
		this backend generateMipmap()
	}
	toRasterDefault: func -> RasterImage {
		packed := this _context createBgra(IntSize2D new(this size width / 4, this size height))
		packMap := this _context getMap(this, GpuMapType pack) as OpenGLES3MapPackMonochrome
		packMap transform = FloatTransform2D identity
		packMap imageSize = this size
		packMap screenSize = this size
		packed canvas draw(this, packMap, Viewport new(packed size))
		buffer := packed canvas readPixels(4)
		result := RasterMonochrome new(buffer, this size)
		packed recycle()
		result
	}
	resizeTo: func (size: IntSize2D) -> This {
		target := OpenGLES3Monochrome create(size, this _context)
		target canvas draw(this)
		target
	}
	_createCanvas: func -> GpuCanvas { OpenGLES3Canvas create(this, this _context) }
	create: static func ~fromRaster (rasterImage: RasterMonochrome, context: GpuContext) -> This {
		result := This new(rasterImage size, rasterImage stride, rasterImage pointer, context)
		result
	}
	create: static func ~empty (size: IntSize2D, context: GpuContext) -> This {
		result := This new(size, context)
		result backend != null ? result : null
	}

}
<commit_msg>Adapted to change in shaders.<commit_after>/*
* Copyright (C) 2014 - <NAME> <<EMAIL>>
*
* This sofware is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with This software. If not, see <http://www.gnu.org/licenses/>.
*/

use ooc-math
use ooc-draw
use ooc-draw-gpu
import OpenGLES3/Texture, OpenGLES3Canvas, OpenGLES3Map

OpenGLES3Monochrome: class extends GpuMonochrome {
	backend: Texture { get { this _backend as Texture } }
	init: func (size: IntSize2D, context: GpuContext) {
		init(size, size width, null, context)
	}
	init: func ~fromPixels (size: IntSize2D, stride: UInt, data: Pointer, context: GpuContext) {
		super(size, context)
		this _backend = Texture create(TextureType monochrome, size width, size height, stride, data) as Pointer
	}
	init: func ~fromTexture (texture: Texture, size: IntSize2D, context: GpuContext) {
		super(size, context)
		this _backend = texture
	}
	bind: func (unit: UInt) {
		this backend bind(unit)
	}
	unbind: func {
		this backend unbind()
	}
	dispose: func {
		this backend dispose()
		if (this _canvas != null)
			this _canvas dispose()
	}
	upload: func (raster: RasterImage) {
		this backend uploadPixels(raster pointer, raster stride)
	}
	setFilter: func (filter: Bool) {
		this backend setFilter(filter)
	}
	generateMipmap: func {
		this backend generateMipmap()
	}
	toRasterDefault: func -> RasterImage {
		packed := this _context createBgra(IntSize2D new(this size width / 4, this size height))
		packMap := this _context getMap(this, GpuMapType pack) as OpenGLES3MapPackMonochrome
		packMap imageWidth = this size width
		packed canvas draw(this, packMap, Viewport new(packed size))
		buffer := packed canvas readPixels(4)
		result := RasterMonochrome new(buffer, this size)
		packed recycle()
		result
	}
	resizeTo: func (size: IntSize2D) -> This {
		target := OpenGLES3Monochrome create(size, this _context)
		target canvas draw(this)
		target
	}
	_createCanvas: func -> GpuCanvas { OpenGLES3Canvas create(this, this _context) }
	create: static func ~fromRaster (rasterImage: RasterMonochrome, context: GpuContext) -> This {
		result := This new(rasterImage size, rasterImage stride, rasterImage pointer, context)
		result
	}
	create: static func ~empty (size: IntSize2D, context: GpuContext) -> This {
		result := This new(size, context)
		result backend != null ? result : null
	}

}

{'fraction_non_alphanumeric': 0.0913328729281768, 'fraction_numerical': 0.007424033149171271, 'mean_word_length': 4.511893434823977, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7383219', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1806, 'n_words': 671}