michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrPath_DEFINED michael@0: #define GrPath_DEFINED michael@0: michael@0: #include "GrResource.h" michael@0: #include "GrResourceCache.h" michael@0: #include "SkPath.h" michael@0: #include "SkRect.h" michael@0: #include "SkStrokeRec.h" michael@0: michael@0: class GrPath : public GrResource { michael@0: public: michael@0: SK_DECLARE_INST_COUNT(GrPath); michael@0: michael@0: GrPath(GrGpu* gpu, bool isWrapped, const SkPath& skPath, const SkStrokeRec& stroke) michael@0: : INHERITED(gpu, isWrapped), michael@0: fSkPath(skPath), michael@0: fStroke(stroke), michael@0: fBounds(skPath.getBounds()) { michael@0: } michael@0: michael@0: static GrResourceKey ComputeKey(const SkPath& path, const SkStrokeRec& stroke); michael@0: michael@0: bool isEqualTo(const SkPath& path, const SkStrokeRec& stroke) { michael@0: return fSkPath == path && fStroke == stroke; michael@0: } michael@0: michael@0: const SkRect& getBounds() const { return fBounds; } michael@0: michael@0: const SkStrokeRec& getStroke() const { return fStroke; } michael@0: michael@0: protected: michael@0: SkPath fSkPath; michael@0: SkStrokeRec fStroke; michael@0: SkRect fBounds; michael@0: michael@0: private: michael@0: typedef GrResource INHERITED; michael@0: }; michael@0: michael@0: #endif