Ticket #2458: tex_comments.patch
File tex_comments.patch, 4.2 KB (added by , 10 years ago) |
---|
-
source/lib/tex/tex.cpp
462 462 463 463 TIMER_ADD_CLIENT(tc_transform); 464 464 465 // change <t>'spixel format by flipping the state of all TEX_* flags465 // change the pixel format by flipping the state of all TEX_* flags 466 466 // that are set in transforms. 467 467 Status Tex::transform(size_t transforms) 468 468 { … … 489 489 } 490 490 491 491 492 // change <t>'spixel format to the new format specified by <new_flags>.493 // (note: this is equivalent to t ex_transform(t, t->flags^new_flags).492 // change the pixel format to the new format specified by <new_flags>. 493 // (note: this is equivalent to transform(t, t->flags^new_flags). 494 494 Status Tex::transform_to(size_t new_flags) 495 495 { 496 // t ex_transform takes care of validating <t>496 // transform takes care of validating 497 497 const size_t transforms = m_Flags ^ new_flags; 498 498 return transform(transforms); 499 499 } … … 559 559 //----------------------------------------------------------------------------- 560 560 561 561 // indicate if <filename>'s extension is that of a texture format 562 // supported by tex_load. case-insensitive.562 // supported by Tex::load. case-insensitive. 563 563 // 564 // rationale: tex_load complains if the given file is of an564 // rationale: Tex::load complains if the given file is of an 565 565 // unsupported type. this API allows users to preempt that warning 566 566 // (by checking the filename themselves), and also provides for e.g. 567 567 // enumerating only images in a file picker. … … 580 580 581 581 582 582 // store the given image data into a Tex object; this will be as if 583 // it had been loaded via tex_load.583 // it had been loaded via Tex::load. 584 584 // 585 585 // rationale: support for in-memory images is necessary for 586 586 // emulation of glCompressedTexImage2D and useful overall. … … 609 609 // use of it impossible. 610 610 void Tex::free() 611 611 { 612 // do not validate <t> - this is called from tex_load if loading612 // do not validate - this is called from Tex::load if loading 613 613 // failed, so not all fields may be valid. 614 614 615 615 m_Data.reset(); … … 756 756 757 757 // we could be clever here and avoid the extra alloc if our current 758 758 // memory block ensued from the same kind of texture file. this is 759 // most likely the case if in_img == tex_get_data() + c->hdr_size(0).759 // most likely the case if in_img == get_data() + c->hdr_size(0). 760 760 // this would make for zero-copy IO. 761 761 762 762 const size_t max_out_size = img_size()*4 + 256*KiB; -
source/lib/tex/tex.h
304 304 // 305 305 306 306 /** 307 * Change \<t\>'spixel format.307 * Change the pixel format. 308 308 * 309 309 * @param transforms TexFlags that are to be flipped. 310 310 * @return Status … … 312 312 Status transform(size_t transforms); 313 313 314 314 /** 315 * Change \<t\>'spixel format (2nd version)316 * (note: this is equivalent to tex_transform(t, t-\>flags^new_flags).315 * Change the pixel format (2nd version) 316 * (note: this is equivalent to Tex::transform(t, t-\>flags^new_flags). 317 317 * 318 318 * @param new_flags desired new value of TexFlags. 319 319 * @return Status … … 325 325 // 326 326 327 327 /** 328 * rationale: since Tex is a struct, its fields are accessible to callers.329 * this is more for C compatibility than convenience; the following should330 * be used instead of direct access to the corresponding fields because331 * they take care of some dirty work.332 **/333 334 /**335 328 * return a pointer to the image data (pixels), taking into account any 336 329 * header(s) that may come before it. 337 330 * -
source/lib/tex/tex_codec.h
56 56 * encode the texture data into the codec's file format (in memory). 57 57 * 58 58 * @param t input texture object. note: non-const because encoding may 59 * require a tex_transform.59 * require a Tex::transform. 60 60 * @param da output data array, allocated by codec. 61 61 * rationale: some codecs cannot calculate the output size beforehand 62 62 * (e.g. PNG output via libpng), so the output memory cannot be allocated