Gecko:2DGraphicsSketch: Difference between revisions

Jump to navigation Jump to search
Line 135: Line 135:


  enum PatternType { COLOR, BUFFER, GRADIENT };
  enum PatternType { COLOR, BUFFER, GRADIENT };
 
  class Pattern {
  class Pattern {
  public:
  public:
Line 141: Line 141:
   PatternType Type() { return mType; }
   PatternType Type() { return mType; }
   BackendType Backend() { return mBackend; }
   BackendType Backend() { return mBackend; }
 
   typedef (* PrivateDestructor)(Pattern* aPattern);
   typedef (* PrivateDestructor)(Pattern* aPattern);
 
  protected:
  protected:
   Pattern(PatternType aType) : mType(aType), mPrivate(NULL) {}
   Pattern(PatternType aType) : mType(aType), mPrivate(NULL) {}
 
   PatternType mType : 8;
   PatternType mType : 8;
   BackendType mBackend : 8;
   BackendType mBackend : 8;
Line 161: Line 161:
  public:
  public:
   ColorPattern(const Color& aColor) : Pattern(COLOR), mColor(aColor) {}
   ColorPattern(const Color& aColor) : Pattern(COLOR), mColor(aColor) {}
 
  protected:
  protected:
   Color mColor;
   Color mColor;
Line 169: Line 169:


  enum SampleFilter { NEAREST, BILINEAR };
  enum SampleFilter { NEAREST, BILINEAR };
 
  class BufferPattern : public Pattern {
  class BufferPattern : public Pattern {
  public:
  public:
Line 175: Line 175:
   BufferPattern(SourceBuffer* aBuffer) : Pattern(BUFFER), mBuffer(aBuffer),
   BufferPattern(SourceBuffer* aBuffer) : Pattern(BUFFER), mBuffer(aBuffer),
       mSubimage(Point(0, 0), aBuffer->GetSize()), mFilter(BILINEAR) {}
       mSubimage(Point(0, 0), aBuffer->GetSize()), mFilter(BILINEAR) {}
 
  protected:
  protected:
   RefPtr<SourceBuffer> mBuffer;
   RefPtr<SourceBuffer> mBuffer;
1,295

edits

Navigation menu