module Boleite::Private::OpenGLTexture::Contracts
Defined in:
boleite/backend/graphics/opengl_texture.crConstant Summary
-
CLASS_DATA =
ClassData(Boleite::Private::OpenGLTexture).new
-
CONTRACTED_METHODS =
["initialize()", "create(width : UInt32, height : UInt32, format : Format, type : Type)", "create_depth(width : UInt32, height : UInt32)", "create_internal(width, height, format)", "update(pixels : Pointer(UInt8), width, height, x_dest, y_dest, format : Format)", "update(pixels : Pointer(Float32), width, height, x_dest, y_dest, format : Format)", "update(texture, x, y)", "size()", "format()", "type()", "is_depth?()", "is_smooth?()", "smooth=(val : Bool)", "is_repeating?()", "repeating=(val : Bool)", "activate()", "bind()", "identifier()"] of _
-
CONTRACTS =
{:next_def => nil, def update(pixels : Pointer(UInt8), width, height, x_dest, y_dest, format : Format) : Void activate do GL.safe_call do external_format = self.class.translate_external_format(format) alignment = self.class.translate_unpack_alignment(@format) LibGL.pixelStorei(LibGL::UNPACK_ALIGNMENT, alignment) LibGL.texSubImage2D(LibGL::TEXTURE_2D, 0, x_dest, y_dest, width, height, external_format, LibGL::UNSIGNED_BYTE, pixels) LibGL.pixelStorei(LibGL::UNPACK_ALIGNMENT, 4) end end end => [{:requires, "(x_dest + width) <= @size.x", do (x_dest + width) <= @size.x end}, {:requires, "(y_dest + height) <= @size.y", do (y_dest + height) <= @size.y end}, {:requires, "@depth == false", do @depth == false end}], def update(pixels : Pointer(Float32), width, height, x_dest, y_dest, format : Format) : Void activate do GL.safe_call do external_format = self.class.translate_external_format(format) alignment = self.class.translate_unpack_alignment(@format) LibGL.pixelStorei(LibGL::UNPACK_ALIGNMENT, alignment) LibGL.texSubImage2D(LibGL::TEXTURE_2D, 0, x_dest, y_dest, width, height, external_format, LibGL::FLOAT, pixels) LibGL.pixelStorei(LibGL::UNPACK_ALIGNMENT, 4) end end end => [{:requires, "(x_dest + width) <= @size.x", do (x_dest + width) <= @size.x end}, {:requires, "(y_dest + height) <= @size.y", do (y_dest + height) <= @size.y end}, {:requires, "@depth == false", do @depth == false end}], def update(texture, x, y) : Void src_fb = OpenGLFrameBuffer.new dst_fb = OpenGLFrameBuffer.new tex_size = texture.size.to_i src_fb.attach_buffer(texture, :src, 0_u8) dst_fb.attach_buffer(self, :src, 0_u8) dst_fb.blit(src_fb, IntRect.new(0, 0, tex_size.x, tex_size.y), IntRect.new(x, y, x + tex_size.x, y + tex_size.y)) end => [{:requires, "(x + texture.size.x) <= @size.x", do (x + texture.size.x) <= @size.x end}, {:requires, "(y + texture.size.y) <= @size.y", do (y + texture.size.y) <= @size.y end}]} of _ => _
-
IGNORED_METHODS =
["finalize", "contract_pre_update", "contract_post_update", "contract_requires_update", "contract_ensures_update", "contract_pre_update", "contract_post_update", "contract_requires_update", "contract_ensures_update", "contract_pre_update", "contract_post_update", "contract_requires_update", "contract_ensures_update"] of _
-
INVARIANTS =
[] of _