GUACAMOLE-279: Use guac_terminal_color for color palette assignments.
This commit is contained in:
parent
eec3607b16
commit
c53575b18c
@ -26,7 +26,6 @@
|
||||
#include "terminal/types.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
@ -333,16 +332,16 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display) {
|
||||
}
|
||||
|
||||
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
||||
int index, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
int index, const guac_terminal_color* color) {
|
||||
|
||||
/* Assignment fails if out-of-bounds */
|
||||
if (index < 0 || index > 255)
|
||||
return 1;
|
||||
|
||||
/* Copy color components */
|
||||
display->palette[index].red = red;
|
||||
display->palette[index].green = green;
|
||||
display->palette[index].blue = blue;
|
||||
display->palette[index].red = color->red;
|
||||
display->palette[index].green = color->green;
|
||||
display->palette[index].blue = color->blue;
|
||||
|
||||
/* Color successfully stored */
|
||||
return 0;
|
||||
|
@ -232,9 +232,8 @@ void guac_terminal_display_free(guac_terminal_display* display);
|
||||
void guac_terminal_display_reset_palette(guac_terminal_display* display);
|
||||
|
||||
/**
|
||||
* Replaces the color in the palette at the given index with a new color having
|
||||
* the given RGB components. If the index is invalid, the assignment is
|
||||
* ignored.
|
||||
* Replaces the color in the palette at the given index with the given color.
|
||||
* If the index is invalid, the assignment is ignored.
|
||||
*
|
||||
* @param display
|
||||
* The display whose palette is being changed.
|
||||
@ -242,24 +241,15 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display);
|
||||
* @param index
|
||||
* The index of the palette entry to change.
|
||||
*
|
||||
* @param red
|
||||
* The red color component of the color to assign to the palette entry
|
||||
* having the given index.
|
||||
*
|
||||
* @param green
|
||||
* The green color component of the color to assign to the palette entry
|
||||
* having the given index.
|
||||
*
|
||||
* @param blue
|
||||
* The blue color component of the color to assign to the palette entry
|
||||
* having the given index.
|
||||
* @param color
|
||||
* The color to assign to the palette entry having the given index.
|
||||
*
|
||||
* @returns
|
||||
* Zero if the assignment was successful, non-zero if the assignment
|
||||
* failed.
|
||||
*/
|
||||
int guac_terminal_display_assign_color(guac_terminal_display* display,
|
||||
int index, uint8_t red, uint8_t green, uint8_t blue);
|
||||
int index, const guac_terminal_color* color);
|
||||
|
||||
/**
|
||||
* Retrieves the color within the palette at the given index, if such a color
|
||||
|
Loading…
Reference in New Issue
Block a user