Bug 31219

Summary: Clean up GraphicsContext's current concept of ColorSpace
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: Layout and RenderingAssignee: Beth Dakin <bdakin>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, darin, dglazkov
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch adele: review+

Description Beth Dakin 2009-11-06 17:44:55 PST
Current GraphicsContexts is host to an enumeration called "ColorSpace," and the GraphicsContext state keeps track of a strokeColorSpace and a fillColorSpace. The problem is that the values of ColorSpace -- SolidColorSpace, PatternColorSpace, and GradientColorSpace -- are not actually color spaces. CG is confusing, and that is how this error was made and stayed in the code for so long. I am about to add real ColorSpace support <https://bugs.webkit.org/show_bug.cgi?id=31196>, but first we think it's best to clean up GraphicsContext. I will post a patch shortly to do this.
Comment 1 Beth Dakin 2009-11-06 18:09:26 PST
Created attachment 42681 [details]
Patch

Darin is likely to be at least a little disappointed in this patch since it is more conservative than some other options we discussed for this cleanup. Specifically, Darin noticed that once we have a Pattern or Gradient on the GraphicsContext, we keep a pointer to it forever. I wrote code that would get rid of old Patterns and Gradients once something that is not a Pattern or Gradient is set, but a bunch of canvas pattern tests failed. I haven't investigated the failures closely enough to know whether or not clearing out the pattern is an option or not. Ultimately, it seems like that is just a bigger problem than we are trying to solve today, and I will file a follow-up bug so we can take a look at it later.
Comment 2 Adele Peterson 2009-11-06 18:25:29 PST
Comment on attachment 42681 [details]
Patch

Seems like a fine initial step for cleanup. r=me
Comment 3 Darin Adler 2009-11-06 18:52:07 PST
(In reply to comment #1)
> Darin is likely to be at least a little disappointed in this patch since it is
> more conservative than some other options we discussed for this cleanup.

I'm pretty happy with it.

> I wrote code that would get
> rid of old Patterns and Gradients once something that is not a Pattern or
> Gradient is set, but a bunch of canvas pattern tests failed.

I'll play with that myself if I have some free time. It doesn't seem important to tackle it any time soon -- you can get on to the color space work!
Comment 4 Beth Dakin 2009-11-07 00:00:42 PST
Yay! Thanks Adele and Darin.

Fixed with r50614.
Comment 5 Dimitri Glazkov (Google) 2009-11-08 10:57:19 PST
No Skia changes? :-\