diff options
author | bsalomon <bsalomon@google.com> | 2016-04-25 13:37:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-25 13:37:22 -0700 |
commit | c885dacfe4625af8b0e2e5c6e8a8ae8dc2d620a8 (patch) | |
tree | 8fc3e643c7e8695c02735e5e0e58e4f28d5bffe8 /src/gpu/GrStyle.cpp | |
parent | 21736bd8b51cb78dba14a5bedf6690619fdb9ed3 (diff) |
Add initial implementation of GrShape and GrStyle classes and tests
The initial intent is to use GrShape to simplify the mask blur code paths. However, I also want to use this to explore a more unified drawing code flow for different geometry types. The goal is to have a single representation for geometries+styling that attempts to always keep the geometry in the simplest form (e.g. preferring rrects to paths). It also allows for converting styling information into modified geometry and for computing consistent keys.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1822723003
Review URL: https://codereview.chromium.org/1822723003
Diffstat (limited to 'src/gpu/GrStyle.cpp')
-rw-r--r-- | src/gpu/GrStyle.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp new file mode 100644 index 0000000000..40a148bb4a --- /dev/null +++ b/src/gpu/GrStyle.cpp @@ -0,0 +1,33 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "GrStyle.h" + +void GrStyle::initPathEffect(SkPathEffect* pe) { + if (!pe) { + fDashInfo.fType = SkPathEffect::kNone_DashType; + return; + } + SkPathEffect::DashInfo info; + if (SkPathEffect::kDash_DashType == pe->asADash(&info)) { + if (fStrokeRec.getStyle() == SkStrokeRec::kFill_Style) { + fPathEffect.reset(nullptr); + } else { + fPathEffect.reset(SkSafeRef(pe)); + fDashInfo.fType = SkPathEffect::kDash_DashType; + fDashInfo.fIntervals.reset(info.fCount); + fDashInfo.fPhase = info.fPhase; + info.fIntervals = fDashInfo.fIntervals.get(); + pe->asADash(&info); + return; + } + } else { + fPathEffect.reset(SkSafeRef(pe)); + } + fDashInfo.fType = SkPathEffect::kNone_DashType; + fDashInfo.fIntervals.reset(0); +} |