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 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **object) SK_OVERRIDE; 32 virtual ULONG STDMETHODCALLTYPE AddRef(void) SK_OVERRIDE; 33 virtual ULONG STDMETHODCALLTYPE Release(void) SK_OVERRIDE; 34 35 virtual void STDMETHODCALLTYPE SetFillMode(D2D1_FILL_MODE fillMode) SK_OVERRIDE; 36 virtual void STDMETHODCALLTYPE SetSegmentFlags(D2D1_PATH_SEGMENT vertexFlags) SK_OVERRIDE; 37 virtual void STDMETHODCALLTYPE BeginFigure(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin) SK_OVERRIDE; 38 virtual void STDMETHODCALLTYPE AddLines(const D2D1_POINT_2F *points, UINT pointsCount) SK_OVERRIDE; 39 virtual void STDMETHODCALLTYPE AddBeziers(const D2D1_BEZIER_SEGMENT *beziers, UINT beziersCount) SK_OVERRIDE; 40 virtual void STDMETHODCALLTYPE EndFigure(D2D1_FIGURE_END figureEnd) SK_OVERRIDE; 41 virtual HRESULT STDMETHODCALLTYPE Close() SK_OVERRIDE; 42 43 static HRESULT Create(SkPath* path, IDWriteGeometrySink** geometryToPath); 44 }; 45 46 #endif 47