< prev index next >

src/java.desktop/share/native/common/java2d/opengl/OGLTextRenderer.c

Print this page




 325     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "glyph_tex");
 326     j2d_glUniform1iARB(loc, 0); // texture unit 0
 327     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "dst_tex");
 328     j2d_glUniform1iARB(loc, 1); // texture unit 1
 329 
 330     // "unuse" the program object; it will be re-bound later as needed
 331     j2d_glUseProgramObjectARB(0);
 332 
 333     return lcdTextProgram;
 334 }
 335 
 336 /**
 337  * (Re)Initializes the gamma related uniforms.
 338  *
 339  * The given contrast value is an int in the range [100, 250] which we will
 340  * then scale to fit in the range [1.0, 2.5].
 341  */
 342 static jboolean
 343 OGLTR_UpdateLCDTextContrast(jint contrast)
 344 {
 345     double g = ((double)contrast) / 100.0;
 346     double ig = 1.0 / g;
 347     GLint loc;
 348 
 349     J2dTraceLn1(J2D_TRACE_INFO,
 350                 "OGLTR_UpdateLCDTextContrast: contrast=%d", contrast);
 351 
 352     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "gamma");
 353     j2d_glUniform3fARB(loc, g, g, g);
 354 
 355     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "invgamma");
 356     j2d_glUniform3fARB(loc, ig, ig, ig);
 357 
 358     return JNI_TRUE;
 359 }
 360 
 361 /**
 362  * Updates the current gamma-adjusted source color ("src_adj") of the LCD
 363  * text shader program.  Note that we could calculate this value in the
 364  * shader (e.g. just as we do for "dst_adj"), but would be unnecessary work
 365  * (and a measurable performance hit, maybe around 5%) since this value is
 366  * constant over the entire glyph list.  So instead we just calculate the




 325     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "glyph_tex");
 326     j2d_glUniform1iARB(loc, 0); // texture unit 0
 327     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "dst_tex");
 328     j2d_glUniform1iARB(loc, 1); // texture unit 1
 329 
 330     // "unuse" the program object; it will be re-bound later as needed
 331     j2d_glUseProgramObjectARB(0);
 332 
 333     return lcdTextProgram;
 334 }
 335 
 336 /**
 337  * (Re)Initializes the gamma related uniforms.
 338  *
 339  * The given contrast value is an int in the range [100, 250] which we will
 340  * then scale to fit in the range [1.0, 2.5].
 341  */
 342 static jboolean
 343 OGLTR_UpdateLCDTextContrast(jint contrast)
 344 {
 345     float g = ((float)contrast) / 100.0f;
 346     float ig = 1.0f / g;
 347     GLint loc;
 348 
 349     J2dTraceLn1(J2D_TRACE_INFO,
 350                 "OGLTR_UpdateLCDTextContrast: contrast=%d", contrast);
 351 
 352     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "gamma");
 353     j2d_glUniform3fARB(loc, g, g, g);
 354 
 355     loc = j2d_glGetUniformLocationARB(lcdTextProgram, "invgamma");
 356     j2d_glUniform3fARB(loc, ig, ig, ig);
 357 
 358     return JNI_TRUE;
 359 }
 360 
 361 /**
 362  * Updates the current gamma-adjusted source color ("src_adj") of the LCD
 363  * text shader program.  Note that we could calculate this value in the
 364  * shader (e.g. just as we do for "dst_adj"), but would be unnecessary work
 365  * (and a measurable performance hit, maybe around 5%) since this value is
 366  * constant over the entire glyph list.  So instead we just calculate the


< prev index next >