Skip to content
This repository has been archived by the owner. It is now read-only.

Remove the other Color type. The idea is to use AzColor for everything. #141

Closed
wants to merge 1 commit into from

Conversation

@Adenilson
Copy link
Contributor

Adenilson commented Feb 9, 2015

No description provided.

AzColor { r: r, g: g, b: b, a: a }
}

pub fn hack(color: AzColor) -> AzColor {

This comment has been minimized.

@mrobinson

mrobinson Feb 9, 2015

Member

I really don't think we should have a method called "hack."

This comment has been minimized.

@Adenilson

Adenilson Feb 9, 2015

Author Contributor

Yep, I agree. How you like to have it named?

This comment has been minimized.

@mrobinson

mrobinson Feb 9, 2015

Member

Why is it necessary? It's unclear why you need to create a new AzColor where it's used.

This comment has been minimized.

@Adenilson

Adenilson Feb 9, 2015

Author Contributor

Legacy code calls converting the Color to AzColor and vice-versa. I will
try to remove them.

On Mon, Feb 9, 2015 at 12:38 PM, Martin Robinson notifications@github.com
wrote:

In src/azure.rs
#141 (comment):

@@ -261,6 +261,16 @@ impl PartialEq for AzColor {
}
}

+impl AzColor {

  • pub fn new(r: AzFloat, g: AzFloat, b: AzFloat, a: AzFloat) -> AzColor {
  •     AzColor { r: r, g: g, b: b, a: a }
    
  • }
  • pub fn hack(color: AzColor) -> AzColor {

Why is it necessary? It's unclear why you need to create a new AzColor
where it's used.


Reply to this email directly or view it on GitHub
https://github.com/servo/rust-azure/pull/141/files#r24363008.

@Adenilson
Copy link
Contributor Author

Adenilson commented Feb 9, 2015

Yeah, there is a need to make an explicit copy of a immutable AzColor to pass it to C code. I will rename the function to 'copy' as it better describes it use.

AzColor { r: r, g: g, b: b, a: a }
}

pub fn copy(color: AzColor) -> AzColor {

This comment has been minimized.

@mrobinson

mrobinson Feb 9, 2015

Member

If you derive from Copy do you really need to implement it as well?

@Adenilson Adenilson force-pushed the Adenilson:singleColor01 branch from e7210b2 to 6a7c324 Feb 9, 2015
@@ -244,7 +244,7 @@ pub static AZ_ATT_TRANSFER_DISABLE_B: u32 = 2;
pub static AZ_ATT_TRANSFER_DISABLE_A: u32 = 3;

#[repr(C)]
#[derive(Clone)]
#[derive(Copy, Clone)]

This comment has been minimized.

@mrobinson

mrobinson Feb 9, 2015

Member

Do you need to add Copy since you are simply using clone below?

@mrobinson
Copy link
Member

mrobinson commented Feb 9, 2015

This looks good to me.

@pcwalton
Copy link
Contributor

pcwalton commented Feb 9, 2015

I'm not a huge fan of the Az prefix leaking everywhere—the Az prefix is for the C binding layer only. Having one color type is of course great though. Could you perhaps reexport the AzColor as Color via pub use AzColor as Color?

@Adenilson Adenilson force-pushed the Adenilson:singleColor01 branch from 6a7c324 to d7c59da Feb 11, 2015
@Adenilson
Copy link
Contributor Author

Adenilson commented Feb 11, 2015

Agreed. Please check the updated patch.

(i.e. AzColor).

This patch will also move the auxiliar new() function to inside Servo
(together with rgb(), rgba(), black(), etc).

Also addresses reviewer's comment about AzColor.
@Adenilson Adenilson force-pushed the Adenilson:singleColor01 branch from d7c59da to df57406 Feb 11, 2015
@Adenilson
Copy link
Contributor Author

Adenilson commented Feb 12, 2015

Needs rebase, will close this request and open a new one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.