Fix some silly mistakes

This commit is contained in:
Brendan Zabarauskas 2012-12-05 20:03:39 +10:00
parent bdb8605bd5
commit c442cf148e
2 changed files with 7 additions and 8 deletions

View file

@ -12,7 +12,7 @@ use vec::Vec3;
* The base trait for anglular units
*/
pub trait Angle<T>: Add<self,self>,
Sub<self,self>
Sub<self,self>,
Mul<T,self>,
Div<T,self>,
// Div<self,T>, // TODO: not sure how to implement this, or if it is even possible...

View file

@ -625,11 +625,11 @@ pub impl<T:Copy Float Channel> HSV<T>: Color<T> {
}
}
pub impl<T:Copy Channel> HSV<T>: MutableColor<T> {
pub impl<T:Copy Channel Float> HSV<T>: MutableColor<T> {
#[inline(always)]
fn index_mut(&mut self, i: uint) -> &self/mut T {
match i {
0 => ,
0 => fail(~"can't swap the hue component at index 0 in a HSVA type"),
1 => &mut self.s,
2 => &mut self.v,
_ => fail(fmt!("index out of bounds: expected an index from 0 to 2, but found %u", i))
@ -645,7 +645,7 @@ pub impl<T:Copy Channel> HSV<T>: MutableColor<T> {
#[inline(always)]
fn invert_self(&mut self) {
self.h = self.h.inverse();
self.h = self.h.opposite();
self.s = self.s.inverse();
self.v = self.v.inverse();
}
@ -764,11 +764,11 @@ pub impl<T:Copy Float Channel> HSVA<T>: Color<T> {
}
}
pub impl<T:Copy Channel> HSVA<T>: MutableColor<T> {
pub impl<T:Copy Channel Float> HSVA<T>: MutableColor<T> {
#[inline(always)]
fn index_mut(&mut self, i: uint) -> &self/mut T {
match i {
0 => ,
0 => fail(~"can't swap the hue component at index 0 in a HSVA type"),
1 => &mut self.s,
2 => &mut self.v,
3 => &mut self.a,
@ -778,14 +778,13 @@ pub impl<T:Copy Channel> HSVA<T>: MutableColor<T> {
#[inline(always)]
fn swap(&mut self, a: uint, b: uint) {
if a != 0 && b != 0 { fail(fmt!("can't swap the hue component (at index 0) in a HSVA type: found a: %u, b: %u", a, b)); }
util::swap(self.index_mut(a),
self.index_mut(b));
}
#[inline(always)]
fn invert_self(&mut self) {
self.h = self.h.inverse();
self.h = self.h.opposite();
self.s = self.s.inverse();
self.v = self.v.inverse();
self.a = self.a.inverse();