Mark SkPaths created by GrContext fallback draw logic as volatile

GrContext draw functions (drawRect, drawRRect,...) fall back to
GrContext::drawPath for complex cases. Mark the argument SkPath
as volatile, since it is.

Progressions for nvprmsaa:
          tabl_androidpolice.skp_1	11.6ms -> 10.3ms	0.89x
                desk_twitter.skp_1	9.21ms -> 8.08ms	0.88x
                tabl_sahadan.skp_1	8.97ms -> 7.65ms	0.85x
              desk_wikipedia.skp_1	5.63ms ->  4.5ms	0.8x
                desk_booking.skp_1	11.5ms -> 8.87ms	0.77x
                   desk_ebay.skp_1	   7ms -> 5.37ms	0.77x

Makes rrects and rects go to "simple path" path cache (cached by contents).

No change for msaa, gpu.

BUG=skia:

Review URL: https://codereview.chromium.org/1150993002
This commit is contained in:
kkinnunen 2015-05-21 22:45:56 -07:00 committed by Commit bot
parent 4e13a23d8f
commit 806236e797
2 changed files with 6 additions and 2 deletions

View File

@ -580,6 +580,7 @@ void GrContext::drawRect(GrRenderTarget* rt,
RETURN_IF_ABANDONED RETURN_IF_ABANDONED
if (strokeInfo && strokeInfo->isDashed()) { if (strokeInfo && strokeInfo->isDashed()) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addRect(rect); path.addRect(rect);
this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo); this->drawPath(rt, clip, paint, viewMatrix, path, *strokeInfo);
return; return;
@ -1037,6 +1038,7 @@ void GrContext::drawRRect(GrRenderTarget*rt,
if (strokeInfo.isDashed()) { if (strokeInfo.isDashed()) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addRRect(rrect); path.addRRect(rrect);
this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo);
return; return;
@ -1060,6 +1062,7 @@ void GrContext::drawRRect(GrRenderTarget*rt,
rrect, rrect,
strokeInfo)) { strokeInfo)) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addRRect(rrect); path.addRRect(rrect);
this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(), this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
path, strokeInfo); path, strokeInfo);
@ -1094,10 +1097,10 @@ void GrContext::drawDRRect(GrRenderTarget* rt,
outer, outer,
inner)) { inner)) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addRRect(inner); path.addRRect(inner);
path.addRRect(outer); path.addRRect(outer);
path.setFillType(SkPath::kEvenOdd_FillType); path.setFillType(SkPath::kEvenOdd_FillType);
GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle); GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle);
this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(), this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
path, fillRec); path, fillRec);
@ -1119,6 +1122,7 @@ void GrContext::drawOval(GrRenderTarget* rt,
if (strokeInfo.isDashed()) { if (strokeInfo.isDashed()) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addOval(oval); path.addOval(oval);
this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo); this->drawPath(rt, clip, paint, viewMatrix, path, strokeInfo);
return; return;
@ -1142,6 +1146,7 @@ void GrContext::drawOval(GrRenderTarget* rt,
oval, oval,
strokeInfo)) { strokeInfo)) {
SkPath path; SkPath path;
path.setIsVolatile(true);
path.addOval(oval); path.addOval(oval);
this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(), this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
path, strokeInfo); path, strokeInfo);

View File

@ -62,7 +62,6 @@ inline static bool compute_key_for_simple_path(const SkPath& path, const GrStrok
if (!path.isVolatile()) { if (!path.isVolatile()) {
return false; return false;
} }
// The check below should take care of negative values casted positive. // The check below should take care of negative values casted positive.
const int verbCnt = path.countVerbs(); const int verbCnt = path.countVerbs();
if (verbCnt > kSimpleVolatilePathVerbLimit) { if (verbCnt > kSimpleVolatilePathVerbLimit) {