Changeset 161


Ignore:
Timestamp:
Oct 17, 2009, 3:35:06 PM (5 years ago)
Author:
simon
Message:

Switch bg color to guint8 and add alpha support (for future use)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/memphis-rule-set.c

    r159 r161  
    183183void 
    184184memphis_rule_set_set_bg_color (MemphisRuleSet *self, 
    185     guint16 r, guint16 g, guint16 b) 
     185    guint8 r, 
     186    guint8 g, 
     187    guint8 b, 
     188    guint8 a) 
    186189{ 
    187190  MemphisRuleSetPrivate *priv = MEMPHIS_RULE_SET_GET_PRIVATE (self); 
     
    190193  priv->ruleset->background[1] = (gint16) g; 
    191194  priv->ruleset->background[2] = (gint16) b; 
     195  // TODO: alpha support 
    192196} 
    193197 
    194198void 
    195199memphis_rule_set_get_bg_color (MemphisRuleSet *self, 
    196     guint16 *r, guint16 *g, guint16 *b) 
     200    guint8 *r, 
     201    guint8 *g, 
     202    guint8 *b, 
     203    guint8 *a) 
    197204{ 
    198205  MemphisRuleSetPrivate *priv = MEMPHIS_RULE_SET_GET_PRIVATE (self); 
     
    201208  *g = (guint16) priv->ruleset->background[1]; 
    202209  *b = (guint16) priv->ruleset->background[2]; 
     210  // TODO: alpha support 
    203211} 
    204212 
  • trunk/src/memphis-rule-set.h

    r151 r161  
    6868 
    6969void memphis_rule_set_set_bg_color (MemphisRuleSet *rules, 
    70     guint16 r, guint16 g, guint16 b); 
     70    guint8 r, guint8 g, guint8 b, guint8 a); 
    7171void memphis_rule_set_get_bg_color (MemphisRuleSet *self, 
    72     guint16 *r, guint16 *g, guint16 *b); 
     72    guint8 *r, guint8 *g, guint8 *b, guint8 *a); 
    7373 
    7474GList* memphis_rule_set_get_rule_ids (MemphisRuleSet *rules); 
  • trunk/tests/unit-tests.c

    r160 r161  
    140140{ 
    141141  MemphisRuleSet *rules; 
    142   guint16 r1, g1, b1; 
    143   guint16 r2, g2, b2; 
    144   r2 = g2 = b2 = 0; 
     142  guint8 r1, g1, b1, a1; 
     143  guint8 r2, g2, b2, a2; 
     144  r2 = g2 = b2 = a2 = 0; 
    145145  rules = memphis_rule_set_new (); 
    146146  memphis_rule_set_set_debug_level (rules, 0); 
     
    151151  g1 = (guint16) g_test_rand_int (); 
    152152  b1 = (guint16) g_test_rand_int (); 
    153   memphis_rule_set_set_bg_color (rules, r1, g1, b1); 
    154   memphis_rule_set_get_bg_color (rules, &r2, &g2, &b2); 
     153  a1 = (guint16) g_test_rand_int (); 
     154  memphis_rule_set_set_bg_color (rules, r1, g1, b1, a1); 
     155  memphis_rule_set_get_bg_color (rules, &r2, &g2, &b2, &a2); 
    155156  g_assert_cmpuint(r1, ==, r2); 
    156157  g_assert_cmpuint(g1, ==, g2); 
    157158  g_assert_cmpuint(b1, ==, b2); 
     159  //TODO g_assert_cmpuint(a1, ==, a2); 
    158160  memphis_rule_set_free (rules); 
    159161} 
Note: See TracChangeset for help on using the changeset viewer.