Convert Canvas2D to typed enums and EnumeratedArray

RESOLVED FIXED in mozilla31

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: bjacob, Assigned: bjacob)

Tracking

Trunk
mozilla31
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

No description provided.
Attachment #8398515 - Attachment description: 1/3: Initial manual changes → 1/3 - Initial manual changes
Comment on attachment 8398515 [details] [diff] [review]
1/3 - Initial manual changes

Review of attachment 8398515 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/src/CanvasGradient.h
@@ +75,5 @@
>    Type mType;
>    virtual ~CanvasGradient() {}
>  };
>  
> +MOZ_FINISH_NESTED_ENUM_CLASS(CanvasGradient::Type)

This Macro seems a little oddly named to me :) But it looks correct.
Attachment #8398515 - Flags: review?(bas) → review+
Attachment #8398517 - Flags: review?(bas) → review+
Comment on attachment 8398518 [details] [diff] [review]
3/3 - final manual changes

Review of attachment 8398518 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/src/CanvasRenderingContext2D.h
@@ +916,5 @@
>  
>      nsRefPtr<gfxFontGroup> fontGroup;
> +    EnumeratedArray<Style, Style::MAX, nsRefPtr<CanvasGradient>> gradientStyles;
> +    EnumeratedArray<Style, Style::MAX, nsRefPtr<CanvasPattern>> patternStyles;
> +    EnumeratedArray<Style, Style::MAX, nscolor> colorStyles;

I wonder whether all compilers generate optimal code for this EnumeratedArray class, but I guess it doesn't matter too much.
Attachment #8398518 - Flags: review?(bas) → review+
I wouldn't worry about that at all. I've worked on a array-like container library (matrices really) and went 1000x more crazy than this and compilers these days are good at evaporating this kind of abstraction. Look at EnumeratedArray.h, it's tiny.
You need to log in before you can comment on or make changes to this bug.