[Webkit-unassigned] [Bug 20373] <canvas> code needs fewer #ifdefs (part 2)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 22 01:08:37 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20373





------- Comment #6 from eric at webkit.org  2008-08-22 01:08 PDT -------
We talked about this over IRC.  I propose we move to the following model:

void setStokePattern(const Pattern&);
void setStokeGradient(const Gradient&);

void setFillPattern(const Pattern&);
void setFillGradient(const Gradient&);

void fillPath();
void strokePath();
void drawPath(); // fills and strokes, convenience and speed.  CG has a
fast-path for this.

// more convenience and speed.  CG has a fast-path for rects-only (callers also
don't have to bother with Path objects then)
void fillRect(const FloatRect&);
void strokeRect(const FloatRect&);
void drawRect(const FloatRect&);


Internally, the GraphicsContextState stack gets some extra variables:

Pattern m_fillPattern;
Gradient m_fillGradient;
Pattern m_strokePattern;
Gradient m_strokeGradient;

enum ColorSpace {
  SolidColorSpace,
  PatternColorSpace,
  GradientColorSpace
}

ColorSpace m_fillColorSpace;
ColorSpace m_strokeColorSpace;

I am slightly concerned that adding 2 patterns and 2 gradient objects to each
GraphicsContext state might make them more expensive to work with.   Especially
since each new state inherits from the previous.  We may need to move to some
sort of RefCounted model for Pattern and Gradient over time.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list