mirror of
https://github.com/fltk/fltk.git
synced 2026-05-25 17:42:14 +08:00
Rename variable from txt_buf to alpha_buf
This commit is contained in:
+8
-8
@@ -416,7 +416,7 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
|
||||
|
||||
fifo[current].scale = gl_scale;
|
||||
fifo[current].fdesc = gl_fontsize;
|
||||
char *txt_buf = Fl_Gl_Window_Driver::global()->alpha_mask_for_string(str, n, w, h);
|
||||
char *alpha_buf = Fl_Gl_Window_Driver::global()->alpha_mask_for_string(str, n, w, h);
|
||||
|
||||
// save GL parameters GL_UNPACK_ROW_LENGTH and GL_UNPACK_ALIGNMENT
|
||||
GLint row_length, alignment;
|
||||
@@ -430,12 +430,12 @@ int gl_texture_fifo::compute_texture(const char* str, int n)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, w);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
// GL_ALPHA8 is defined in GL/gl.h of X11 and of MinGW32 and of MinGW64 and of OpenGL.framework for MacOS
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_ALPHA8, w, h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, txt_buf);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_ALPHA8, w, h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_buf);
|
||||
/* For the record: texture construction if an alpha-only-texture is not possible
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, w, h, 0, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, rgba_buf);
|
||||
and also, replace GL_SRC_ALPHA by GL_ONE in glBlendFunc() call of display_texture()
|
||||
*/
|
||||
delete[] txt_buf; // free the buffer now we have copied it into the Gl texture
|
||||
delete[] alpha_buf; // free the buffer now we have copied it into the GL texture
|
||||
glPopAttrib();
|
||||
// restore saved GL parameters
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
|
||||
@@ -525,13 +525,13 @@ char *Fl_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w,
|
||||
Fl_Surface_Device::pop_current();
|
||||
delete image_surface;
|
||||
// This gives us an RGB rendering of the text. We build an alpha channel from that.
|
||||
char *txt_buf = new char [w * h];
|
||||
char *alpha_buf = new char [w * h];
|
||||
for (int idx = 0; idx < w * h; ++idx)
|
||||
{ // Fake up the alpha component using the green component's value
|
||||
txt_buf[idx] = image->array[idx * 3 + 1];
|
||||
alpha_buf[idx] = image->array[idx * 3 + 1];
|
||||
}
|
||||
delete image;
|
||||
return txt_buf;
|
||||
return alpha_buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -782,7 +782,7 @@ char *Fl_Cocoa_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, i
|
||||
fl_font(f, s * gl_scale);
|
||||
fl_draw(str, n, 0, fl_height() - fl_descent());
|
||||
// get the alpha channel only of the bitmap
|
||||
char *txt_buf = new char[w*h], *r = txt_buf, *q;
|
||||
char *alpha_buf = new char[w*h], *r = alpha_buf, *q;
|
||||
q = (char*)CGBitmapContextGetData(surf->offscreen());
|
||||
for (int i = 0; i < h; i++) {
|
||||
for (int j = 0; j < w; j++) {
|
||||
@@ -792,7 +792,7 @@ char *Fl_Cocoa_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, i
|
||||
}
|
||||
Fl_Surface_Device::pop_current();
|
||||
delete surf;
|
||||
return txt_buf;
|
||||
return alpha_buf;
|
||||
}
|
||||
|
||||
#endif // FL_CFG_GFX_QUARTZ
|
||||
|
||||
Reference in New Issue
Block a user