Home | History | Annotate | Download | only in win
      1 /*
      2  * Copyright 2012 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkDWriteToPath_DEFINED
      9 #define SkDWriteToPath_DEFINED
     10 
     11 #include "SkTypes.h"
     12 
     13 class SkPath;
     14 
     15 #include <dwrite.h>
     16 #include <d2d1.h>
     17 
     18 class SkDWriteGeometrySink : public IDWriteGeometrySink {
     19 private:
     20     LONG fRefCount;
     21     SkPath* fPath;
     22 
     23     SkDWriteGeometrySink(const SkDWriteGeometrySink&);
     24     SkDWriteGeometrySink& operator=(const SkDWriteGeometrySink&);
     25 
     26 protected:
     27     explicit SkDWriteGeometrySink(SkPath* path);
     28     virtual ~SkDWriteGeometrySink();
     29 
     30 public:
     31     HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object) override;
     32     ULONG STDMETHODCALLTYPE AddRef(void) override;
     33     ULONG STDMETHODCALLTYPE Release(void) override;
     34 
     35     void STDMETHODCALLTYPE SetFillMode(D2D1_FILL_MODE fillMode) override;
     36     void STDMETHODCALLTYPE SetSegmentFlags(D2D1_PATH_SEGMENT vertexFlags) override;
     37     void STDMETHODCALLTYPE BeginFigure(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin) override;
     38     void STDMETHODCALLTYPE AddLines(const D2D1_POINT_2F *points, UINT pointsCount) override;
     39     void STDMETHODCALLTYPE AddBeziers(const D2D1_BEZIER_SEGMENT *beziers, UINT beziersCount) override;
     40     void STDMETHODCALLTYPE EndFigure(D2D1_FIGURE_END figureEnd) override;
     41     HRESULT STDMETHODCALLTYPE Close() override;
     42 
     43     static HRESULT Create(SkPath* path, IDWriteGeometrySink** geometryToPath);
     44 };
     45 
     46 #endif
     47