Add kAAHairline to GpuPathRenderers
With the upcoming ccpr stroking, this will no longer be the only path renderer that can handle hairlines. Bug: skia: Change-Id: I45b30ccd578bee1388a3a07a234af76a19768de6 Reviewed-on: https://skia-review.googlesource.com/142272 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
55b1e61684
commit
9acfc6cac2
@ -224,7 +224,7 @@ struct GrContextOptions {
|
||||
/**
|
||||
* Include or exclude specific GPU path renderers.
|
||||
*/
|
||||
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
|
||||
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
|
||||
|
||||
/**
|
||||
* Disables using multiple texture units to batch multiple images into a single draw on
|
||||
|
@ -972,14 +972,14 @@ enum class GpuPathRenderers {
|
||||
kNone = 0, // Always use sofware masks and/or GrDefaultPathRenderer.
|
||||
kDashLine = 1 << 0,
|
||||
kStencilAndCover = 1 << 1,
|
||||
kAAConvex = 1 << 2,
|
||||
kAALinearizing = 1 << 3,
|
||||
kSmall = 1 << 4,
|
||||
kCoverageCounting = 1 << 5,
|
||||
kTessellating = 1 << 6,
|
||||
kCoverageCounting = 1 << 2,
|
||||
kAAHairline = 1 << 3,
|
||||
kAAConvex = 1 << 4,
|
||||
kAALinearizing = 1 << 5,
|
||||
kSmall = 1 << 6,
|
||||
kTessellating = 1 << 7,
|
||||
|
||||
kAll = (kTessellating | (kTessellating - 1)),
|
||||
kDefault = kAll
|
||||
kAll = (kTessellating | (kTessellating - 1))
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -34,10 +34,6 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
|
||||
fChain.push_back(std::move(pr));
|
||||
}
|
||||
}
|
||||
|
||||
// AA hairline path renderer is very specialized - no other renderer can do this job well
|
||||
fChain.push_back(sk_make_sp<GrAAHairLinePathRenderer>());
|
||||
|
||||
if (options.fGpuPathRenderers & GpuPathRenderers::kCoverageCounting) {
|
||||
using AllowCaching = GrCoverageCountingPathRenderer::AllowCaching;
|
||||
if (auto ccpr = GrCoverageCountingPathRenderer::CreateIfSupported(
|
||||
@ -47,6 +43,9 @@ GrPathRendererChain::GrPathRendererChain(GrContext* context, const Options& opti
|
||||
fChain.push_back(std::move(ccpr));
|
||||
}
|
||||
}
|
||||
if (options.fGpuPathRenderers & GpuPathRenderers::kAAHairline) {
|
||||
fChain.push_back(sk_make_sp<GrAAHairLinePathRenderer>());
|
||||
}
|
||||
if (options.fGpuPathRenderers & GpuPathRenderers::kAAConvex) {
|
||||
fChain.push_back(sk_make_sp<GrAAConvexPathRenderer>());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class GrPathRendererChain : public SkNoncopyable {
|
||||
public:
|
||||
struct Options {
|
||||
bool fAllowPathMaskCaching = false;
|
||||
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
|
||||
GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
|
||||
};
|
||||
GrPathRendererChain(GrContext* context, const Options&);
|
||||
|
||||
|
@ -161,10 +161,10 @@ DEFINE_bool(cachePathMasks, true, "Allows path mask textures to be cached in GPU
|
||||
|
||||
DEFINE_bool(noGS, false, "Disables support for geometry shaders.");
|
||||
|
||||
DEFINE_string(pr, "default",
|
||||
DEFINE_string(pr, "all",
|
||||
"Set of enabled gpu path renderers. Defined as a list of: "
|
||||
"[~]all [~]default [~]dashline [~]nvpr [~]aaconvex "
|
||||
"[~]aalinearizing [~]small [~]tess]");
|
||||
"[~]none [~]dashline [~]nvpr [~]ccpr [~]aahairline [~]aaconvex [~]aalinearizing "
|
||||
"[~]small [~]tess] [~]all");
|
||||
|
||||
void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
|
||||
static std::unique_ptr<SkExecutor> gGpuExecutor = (0 != FLAGS_gpuThreads)
|
||||
|
@ -18,26 +18,26 @@ DECLARE_bool(noGS);
|
||||
DECLARE_string(pr);
|
||||
|
||||
inline GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
|
||||
if (!strcmp(name, "all")) {
|
||||
return GpuPathRenderers::kAll;
|
||||
} else if (!strcmp(name, "default")) {
|
||||
return GpuPathRenderers::kDefault;
|
||||
if (!strcmp(name, "none")) {
|
||||
return GpuPathRenderers::kNone;
|
||||
} else if (!strcmp(name, "dashline")) {
|
||||
return GpuPathRenderers::kDashLine;
|
||||
} else if (!strcmp(name, "nvpr")) {
|
||||
return GpuPathRenderers::kStencilAndCover;
|
||||
} else if (!strcmp(name, "ccpr")) {
|
||||
return GpuPathRenderers::kCoverageCounting;
|
||||
} else if (!strcmp(name, "aahairline")) {
|
||||
return GpuPathRenderers::kAAHairline;
|
||||
} else if (!strcmp(name, "aaconvex")) {
|
||||
return GpuPathRenderers::kAAConvex;
|
||||
} else if (!strcmp(name, "aalinearizing")) {
|
||||
return GpuPathRenderers::kAALinearizing;
|
||||
} else if (!strcmp(name, "small")) {
|
||||
return GpuPathRenderers::kSmall;
|
||||
} else if (!strcmp(name, "ccpr")) {
|
||||
return GpuPathRenderers::kCoverageCounting;
|
||||
} else if (!strcmp(name, "tess")) {
|
||||
return GpuPathRenderers::kTessellating;
|
||||
} else if (!strcmp(name, "none")) {
|
||||
return GpuPathRenderers::kNone;
|
||||
} else if (!strcmp(name, "all")) {
|
||||
return GpuPathRenderers::kAll;
|
||||
}
|
||||
SK_ABORT(SkStringPrintf("error: unknown named path renderer \"%s\"\n", name).c_str());
|
||||
return GpuPathRenderers::kNone;
|
||||
@ -45,10 +45,10 @@ inline GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
|
||||
|
||||
inline GpuPathRenderers CollectGpuPathRenderersFromFlags() {
|
||||
if (FLAGS_pr.isEmpty()) {
|
||||
return GpuPathRenderers::kDefault;
|
||||
return GpuPathRenderers::kAll;
|
||||
}
|
||||
GpuPathRenderers gpuPathRenderers = '~' == FLAGS_pr[0][0] ?
|
||||
GpuPathRenderers::kDefault : GpuPathRenderers::kNone;
|
||||
GpuPathRenderers gpuPathRenderers = '~' == FLAGS_pr[0][0]
|
||||
? GpuPathRenderers::kAll : GpuPathRenderers::kNone;
|
||||
for (int i = 0; i < FLAGS_pr.count(); ++i) {
|
||||
const char* name = FLAGS_pr[i];
|
||||
if (name[0] == '~') {
|
||||
|
Loading…
Reference in New Issue
Block a user