cogl: Stop hardcoding Color size
Especially that the fields are public now and with a potential migration to floats. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
This commit is contained in:
parent
5f22fddc26
commit
5851738db4
7 changed files with 7 additions and 77 deletions
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Intel Corporation.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person
|
|
||||||
* obtaining a copy of this software and associated documentation
|
|
||||||
* files (the "Software"), to deal in the Software without
|
|
||||||
* restriction, including without limitation the rights to use, copy,
|
|
||||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
* of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Robert Bragg <robert@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cogl/cogl-color.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
/* cogl-pipeline.c wants to be able to hash CoglColor data so it needs
|
|
||||||
* the exact data size to be able to avoid reading the padding bytes.
|
|
||||||
*/
|
|
||||||
#define _COGL_COLOR_DATA_SIZE 4
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_color_get_rgba_4ubv (const CoglColor *color,
|
|
||||||
uint8_t *dest);
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#include "cogl/cogl-util.h"
|
#include "cogl/cogl-util.h"
|
||||||
#include "cogl/cogl-color.h"
|
#include "cogl/cogl-color.h"
|
||||||
#include "cogl/cogl-color-private.h"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_value_transform_color_string (const GValue *src,
|
cogl_value_transform_color_string (const GValue *src,
|
||||||
|
@ -430,13 +429,6 @@ cogl_color_hash (gconstpointer v)
|
||||||
color->red << 24);
|
color->red << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_color_get_rgba_4ubv (const CoglColor *color,
|
|
||||||
uint8_t *dest)
|
|
||||||
{
|
|
||||||
memcpy (dest, color, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_color_to_hsl (const CoglColor *color,
|
cogl_color_to_hsl (const CoglColor *color,
|
||||||
float *hue,
|
float *hue,
|
||||||
|
|
|
@ -1526,7 +1526,7 @@ _cogl_journal_log_quad (CoglJournal *journal,
|
||||||
int next_entry;
|
int next_entry;
|
||||||
uint32_t disable_layers;
|
uint32_t disable_layers;
|
||||||
CoglJournalEntry *entry;
|
CoglJournalEntry *entry;
|
||||||
CoglPipeline *final_pipeline;
|
CoglPipeline *final_pipeline, *color_authority;
|
||||||
CoglClipStack *clip_stack;
|
CoglClipStack *clip_stack;
|
||||||
CoglPipelineFlushOptions flush_options;
|
CoglPipelineFlushOptions flush_options;
|
||||||
CoglMatrixStack *modelview_stack;
|
CoglMatrixStack *modelview_stack;
|
||||||
|
@ -1561,7 +1561,9 @@ _cogl_journal_log_quad (CoglJournal *journal,
|
||||||
|
|
||||||
/* FIXME: This is a hacky optimization, since it will break if we
|
/* FIXME: This is a hacky optimization, since it will break if we
|
||||||
* change the definition of CoglColor: */
|
* change the definition of CoglColor: */
|
||||||
_cogl_pipeline_get_colorubv (pipeline, (uint8_t *) v);
|
color_authority = _cogl_pipeline_get_authority (pipeline,
|
||||||
|
COGL_PIPELINE_STATE_COLOR);
|
||||||
|
memcpy ((uint8_t *) v, &color_authority->color, sizeof (CoglColor));
|
||||||
v++;
|
v++;
|
||||||
|
|
||||||
memcpy (v, position, sizeof (float) * 2);
|
memcpy (v, position, sizeof (float) * 2);
|
||||||
|
|
|
@ -669,10 +669,6 @@ _cogl_pipeline_weak_copy (CoglPipeline *pipeline,
|
||||||
CoglPipelineDestroyCallback callback,
|
CoglPipelineDestroyCallback callback,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_pipeline_get_colorubv (CoglPipeline *pipeline,
|
|
||||||
uint8_t *color);
|
|
||||||
|
|
||||||
/* XXX: At some point it could be good for this to accept a mask of
|
/* XXX: At some point it could be good for this to accept a mask of
|
||||||
* the state groups we are interested in comparing since we can
|
* the state groups we are interested in comparing since we can
|
||||||
* probably use that information in a number situations to reduce
|
* probably use that information in a number situations to reduce
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "cogl/cogl-context-private.h"
|
#include "cogl/cogl-context-private.h"
|
||||||
#include "cogl/cogl-color-private.h"
|
#include "cogl/cogl-color.h"
|
||||||
#include "cogl/cogl-blend-string.h"
|
#include "cogl/cogl-blend-string.h"
|
||||||
#include "cogl/cogl-util.h"
|
#include "cogl/cogl-util.h"
|
||||||
#include "cogl/cogl-depth-state-private.h"
|
#include "cogl/cogl-depth-state-private.h"
|
||||||
|
@ -328,17 +328,6 @@ cogl_pipeline_get_color (CoglPipeline *pipeline,
|
||||||
*color = authority->color;
|
*color = authority->color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used heavily by the cogl journal when logging quads */
|
|
||||||
void
|
|
||||||
_cogl_pipeline_get_colorubv (CoglPipeline *pipeline,
|
|
||||||
uint8_t *color)
|
|
||||||
{
|
|
||||||
CoglPipeline *authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR);
|
|
||||||
|
|
||||||
_cogl_color_get_rgba_4ubv (&authority->color, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_pipeline_set_color (CoglPipeline *pipeline,
|
cogl_pipeline_set_color (CoglPipeline *pipeline,
|
||||||
const CoglColor *color)
|
const CoglColor *color)
|
||||||
|
@ -1248,7 +1237,7 @@ _cogl_pipeline_hash_color_state (CoglPipeline *authority,
|
||||||
CoglPipelineHashState *state)
|
CoglPipelineHashState *state)
|
||||||
{
|
{
|
||||||
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &authority->color,
|
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &authority->color,
|
||||||
_COGL_COLOR_DATA_SIZE);
|
sizeof (CoglColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "cogl/cogl-texture-private.h"
|
#include "cogl/cogl-texture-private.h"
|
||||||
#include "cogl/cogl-blend-string.h"
|
#include "cogl/cogl-blend-string.h"
|
||||||
#include "cogl/cogl-journal-private.h"
|
#include "cogl/cogl-journal-private.h"
|
||||||
#include "cogl/cogl-color-private.h"
|
#include "cogl/cogl-color.h"
|
||||||
#include "cogl/cogl-util.h"
|
#include "cogl/cogl-util.h"
|
||||||
#include "cogl/cogl-profile.h"
|
#include "cogl/cogl-profile.h"
|
||||||
#include "cogl/cogl-depth-state-private.h"
|
#include "cogl/cogl-depth-state-private.h"
|
||||||
|
|
|
@ -170,7 +170,6 @@ cogl_sources = [
|
||||||
'cogl-clip-stack.h',
|
'cogl-clip-stack.h',
|
||||||
'cogl-closure-list-private.h',
|
'cogl-closure-list-private.h',
|
||||||
'cogl-closure-list.c',
|
'cogl-closure-list.c',
|
||||||
'cogl-color-private.h',
|
|
||||||
'cogl-color.c',
|
'cogl-color.c',
|
||||||
'cogl-context-private.h',
|
'cogl-context-private.h',
|
||||||
'cogl-context.c',
|
'cogl-context.c',
|
||||||
|
|
Loading…
Reference in a new issue