164aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com/* 264aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com * Copyright 2012 Google Inc. 364aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com * 464aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com * Use of this source code is governed by a BSD-style license that can be 564aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com * found in the LICENSE file. 664aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com */ 764aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 864aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com#ifndef GrPath_DEFINED 964aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com#define GrPath_DEFINED 1064aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 11089a780c3355129eefc942246534bc1f126b8ccbcommit-bot@chromium.org#include "GrGpuObject.h" 125c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org#include "GrResourceCache.h" 135c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org#include "SkPath.h" 14fd03d4a829efe2d77a712fd991927c55f59a2ffecommit-bot@chromium.org#include "SkRect.h" 1532184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org#include "SkStrokeRec.h" 1664aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 17089a780c3355129eefc942246534bc1f126b8ccbcommit-bot@chromium.orgclass GrPath : public GrGpuObject { 1864aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.compublic: 197fa18762e0ab64c3473df3aab0c2bfd6fabd8831robertphillips@google.com SK_DECLARE_INST_COUNT(GrPath); 207fa18762e0ab64c3473df3aab0c2bfd6fabd8831robertphillips@google.com 215c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org GrPath(GrGpu* gpu, bool isWrapped, const SkPath& skPath, const SkStrokeRec& stroke) 2232184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org : INHERITED(gpu, isWrapped), 235c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org fSkPath(skPath), 245c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org fStroke(stroke), 255c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org fBounds(skPath.getBounds()) { 265c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org } 275c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org 285c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org static GrResourceKey ComputeKey(const SkPath& path, const SkStrokeRec& stroke); 295c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org 305c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org bool isEqualTo(const SkPath& path, const SkStrokeRec& stroke) { 315c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org return fSkPath == path && fStroke == stroke; 3232184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org } 3364aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 34fd03d4a829efe2d77a712fd991927c55f59a2ffecommit-bot@chromium.org const SkRect& getBounds() const { return fBounds; } 3564aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 3632184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org const SkStrokeRec& getStroke() const { return fStroke; } 3732184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org 3864aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.comprotected: 395c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org SkPath fSkPath; 4032184d81629e39809bb9e915286d8fe971a8ed68commit-bot@chromium.org SkStrokeRec fStroke; 415c8ee2539b9316b22416a991a1f560ef5cec7957commit-bot@chromium.org SkRect fBounds; 4264aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 4364aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.comprivate: 44089a780c3355129eefc942246534bc1f126b8ccbcommit-bot@chromium.org typedef GrGpuObject INHERITED; 4564aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com}; 4664aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com 4764aef2bacd1f5c25ffd9347aabd6265c9b60c0f4bsalomon@google.com#endif 48