Remove clip from GrPipelineBuilder
This eliminates a copy and will allow us to make the GrClip class virutal. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1966903004 Review-Url: https://codereview.chromium.org/1966903004
This commit is contained in:
parent
193d9cf8f2
commit
862cff30ea
@ -107,10 +107,7 @@ protected:
|
||||
GrColor color = kColors[procColor];
|
||||
SkAutoTUnref<GrFragmentProcessor> fp(GrConstColorProcessor::Create(color, mode));
|
||||
|
||||
GrClip clip;
|
||||
GrPipelineBuilder pipelineBuilder(grPaint,
|
||||
drawContext->accessRenderTarget(),
|
||||
clip);
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, drawContext->accessRenderTarget());
|
||||
pipelineBuilder.addColorFragmentProcessor(fp);
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
|
@ -308,7 +308,7 @@ private:
|
||||
|
||||
// This entry point allows the GrTextContext-derived classes to add their batches to
|
||||
// the drawTarget.
|
||||
void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch);
|
||||
void drawBatch(GrPipelineBuilder* pipelineBuilder, const GrClip&, GrDrawBatch* batch);
|
||||
|
||||
GrDrawTarget* getDrawTarget();
|
||||
|
||||
|
@ -50,12 +50,13 @@ static const GrFragmentProcessor* create_fp_for_mask(GrTexture* result, const Sk
|
||||
|
||||
static void draw_non_aa_rect(GrDrawTarget* drawTarget,
|
||||
const GrPipelineBuilder& pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
|
||||
nullptr, nullptr));
|
||||
drawTarget->drawBatch(pipelineBuilder, batch);
|
||||
drawTarget->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
// Does the path in 'element' require SW rendering? If so, return true (and,
|
||||
@ -136,10 +137,9 @@ GrPathRenderer* GrClipMaskManager::GetPathRenderer(GrContext* context,
|
||||
return pr;
|
||||
}
|
||||
|
||||
GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget, bool debugClipBatchToBounds)
|
||||
GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget)
|
||||
: fDrawTarget(drawTarget)
|
||||
, fClipMode(kIgnoreClip_StencilClipMode)
|
||||
, fDebugClipBatchToBounds(debugClipBatchToBounds) {
|
||||
, fClipMode(kIgnoreClip_StencilClipMode) {
|
||||
}
|
||||
|
||||
GrContext* GrClipMaskManager::getContext() {
|
||||
@ -284,74 +284,11 @@ bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis
|
||||
return !failed;
|
||||
}
|
||||
|
||||
static void add_rect_to_clip(const GrClip& clip, const SkRect& devRect, GrClip* out) {
|
||||
switch (clip.clipType()) {
|
||||
case GrClip::kClipStack_ClipType: {
|
||||
SkClipStack* stack = new SkClipStack;
|
||||
*stack = *clip.clipStack();
|
||||
// The stack is actually in clip space not device space.
|
||||
SkRect clipRect = devRect;
|
||||
SkPoint origin = { SkIntToScalar(clip.origin().fX), SkIntToScalar(clip.origin().fY) };
|
||||
clipRect.offset(origin);
|
||||
SkIRect iclipRect;
|
||||
clipRect.roundOut(&iclipRect);
|
||||
clipRect = SkRect::Make(iclipRect);
|
||||
stack->clipDevRect(clipRect, SkRegion::kIntersect_Op, false);
|
||||
out->setClipStack(stack, &clip.origin());
|
||||
break;
|
||||
}
|
||||
case GrClip::kWideOpen_ClipType:
|
||||
*out = GrClip(devRect);
|
||||
break;
|
||||
case GrClip::kIRect_ClipType: {
|
||||
SkIRect intersect;
|
||||
devRect.roundOut(&intersect);
|
||||
if (intersect.intersect(clip.irect())) {
|
||||
*out = GrClip(intersect);
|
||||
} else {
|
||||
*out = clip;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GrClipMaskManager::setupScissorClip(const GrPipelineBuilder& pipelineBuilder,
|
||||
const SkIRect& clipScissor,
|
||||
const SkRect* devBounds,
|
||||
GrAppliedClip* out) {
|
||||
SkASSERT(kModifyClip_StencilClipMode != fClipMode); // TODO: Remove fClipMode.
|
||||
fClipMode = kIgnoreClip_StencilClipMode;
|
||||
|
||||
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
|
||||
|
||||
SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
|
||||
SkIRect devBoundsScissor;
|
||||
const SkIRect* scissor = &clipScissor;
|
||||
bool doDevBoundsClip = fDebugClipBatchToBounds && devBounds;
|
||||
if (doDevBoundsClip) {
|
||||
devBounds->roundOut(&devBoundsScissor);
|
||||
if (devBoundsScissor.intersect(clipScissor)) {
|
||||
scissor = &devBoundsScissor;
|
||||
}
|
||||
}
|
||||
|
||||
if (scissor->contains(clipSpaceRTIBounds)) {
|
||||
// This counts as wide open
|
||||
return true;
|
||||
}
|
||||
|
||||
if (clipSpaceRTIBounds.intersect(*scissor)) {
|
||||
out->fScissorState.set(clipSpaceRTIBounds);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// sort out what kind of clip mask needs to be created: alpha, stencil,
|
||||
// scissor, or entirely software
|
||||
bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
const SkRect* devBounds,
|
||||
GrAppliedClip* out) {
|
||||
if (kRespectClip_StencilClipMode == fClipMode) {
|
||||
@ -369,13 +306,6 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
|
||||
SkASSERT(rt);
|
||||
|
||||
SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
|
||||
GrClip devBoundsClip;
|
||||
bool doDevBoundsClip = fDebugClipBatchToBounds && devBounds;
|
||||
if (doDevBoundsClip) {
|
||||
add_rect_to_clip(pipelineBuilder.clip(), *devBounds, &devBoundsClip);
|
||||
}
|
||||
const GrClip& clip = doDevBoundsClip ? devBoundsClip : pipelineBuilder.clip();
|
||||
|
||||
if (clip.isWideOpen(clipSpaceRTIBounds)) {
|
||||
return true;
|
||||
}
|
||||
@ -528,7 +458,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
|
||||
}
|
||||
|
||||
static bool stencil_element(GrDrawContext* dc,
|
||||
const SkIRect* scissorRect,
|
||||
const GrClip& clip,
|
||||
const GrUserStencilSettings* ss,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkClipStack::Element* element) {
|
||||
@ -539,7 +469,7 @@ static bool stencil_element(GrDrawContext* dc,
|
||||
SkDEBUGFAIL("Should never get here with an empty element.");
|
||||
break;
|
||||
case Element::kRect_Type:
|
||||
return dc->drawContextPriv().drawAndStencilRect(scissorRect, ss,
|
||||
return dc->drawContextPriv().drawAndStencilRect(clip, ss,
|
||||
element->getOp(),
|
||||
element->isInverseFilled(),
|
||||
element->isAA(),
|
||||
@ -552,7 +482,7 @@ static bool stencil_element(GrDrawContext* dc,
|
||||
path.toggleInverseFillType();
|
||||
}
|
||||
|
||||
return dc->drawContextPriv().drawAndStencilPath(scissorRect, ss,
|
||||
return dc->drawContextPriv().drawAndStencilPath(clip, ss,
|
||||
element->getOp(),
|
||||
element->isInverseFilled(),
|
||||
element->isAA(), viewMatrix, path);
|
||||
@ -673,6 +603,8 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
|
||||
}
|
||||
#endif
|
||||
|
||||
GrClip clip(maskSpaceIBounds);
|
||||
|
||||
// draw directly into the result with the stencil set to make the pixels affected
|
||||
// by the clip shape be non-zero.
|
||||
static constexpr GrUserStencilSettings kStencilInElement(
|
||||
@ -684,7 +616,7 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
|
||||
GrUserStencilOp::kReplace,
|
||||
0xffff>()
|
||||
);
|
||||
if (!stencil_element(dc.get(), &maskSpaceIBounds, &kStencilInElement,
|
||||
if (!stencil_element(dc.get(), clip, &kStencilInElement,
|
||||
translate, element)) {
|
||||
texture->resourcePriv().removeUniqueKey();
|
||||
return nullptr;
|
||||
@ -700,7 +632,7 @@ GrTexture* GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
|
||||
GrUserStencilOp::kZero,
|
||||
0xffff>()
|
||||
);
|
||||
if (!dc->drawContextPriv().drawAndStencilRect(&maskSpaceIBounds, &kDrawOutsideElement,
|
||||
if (!dc->drawContextPriv().drawAndStencilRect(clip, &kDrawOutsideElement,
|
||||
op, !invert, false,
|
||||
translate,
|
||||
SkRect::Make(clipSpaceIBounds))) {
|
||||
@ -760,7 +692,6 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
const Element* element = iter.get();
|
||||
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
pipelineBuilder.setClip(clip);
|
||||
pipelineBuilder.setRenderTarget(rt);
|
||||
|
||||
pipelineBuilder.setDisableColorXPFactory();
|
||||
@ -835,7 +766,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
if (Element::kRect_Type == element->getType()) {
|
||||
pipelineBuilder.setUserStencil(&kDrawToStencil);
|
||||
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_WHITE, viewMatrix,
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrColor_WHITE, viewMatrix,
|
||||
element->getRect());
|
||||
} else {
|
||||
if (!clipPath.isEmpty()) {
|
||||
@ -846,6 +777,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
args.fTarget = fDrawTarget;
|
||||
args.fResourceProvider = this->getContext()->resourceProvider();
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &clip;
|
||||
args.fColor = GrColor_WHITE;
|
||||
args.fViewMatrix = &viewMatrix;
|
||||
args.fPath = &clipPath;
|
||||
@ -858,6 +790,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
args.fTarget = fDrawTarget;
|
||||
args.fResourceProvider = this->getContext()->resourceProvider();
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &clip;
|
||||
args.fViewMatrix = &viewMatrix;
|
||||
args.fPath = &clipPath;
|
||||
pr->stencilPath(args);
|
||||
@ -874,13 +807,14 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
|
||||
if (drawDirectToClip) {
|
||||
if (Element::kRect_Type == element->getType()) {
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_WHITE, viewMatrix,
|
||||
element->getRect());
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrColor_WHITE,
|
||||
viewMatrix, element->getRect());
|
||||
} else {
|
||||
GrPathRenderer::DrawPathArgs args;
|
||||
args.fTarget = fDrawTarget;
|
||||
args.fResourceProvider = this->getContext()->resourceProvider();
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &clip;
|
||||
args.fColor = GrColor_WHITE;
|
||||
args.fViewMatrix = &viewMatrix;
|
||||
args.fPath = &clipPath;
|
||||
@ -892,7 +826,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
||||
} else {
|
||||
// The view matrix is setup to do clip space -> stencil space translation, so
|
||||
// draw rect in clip space.
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, GrColor_WHITE, viewMatrix,
|
||||
draw_non_aa_rect(fDrawTarget, pipelineBuilder, clip, GrColor_WHITE, viewMatrix,
|
||||
SkRect::Make(clipSpaceIBounds));
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "SkTLList.h"
|
||||
#include "SkTypes.h"
|
||||
|
||||
class GrClip;
|
||||
class GrDrawTarget;
|
||||
class GrPathRenderer;
|
||||
class GrPathRendererChain;
|
||||
@ -56,7 +57,7 @@ private:
|
||||
*/
|
||||
class GrClipMaskManager : SkNoncopyable {
|
||||
public:
|
||||
GrClipMaskManager(GrDrawTarget* owner, bool debugClipBatchToBounds);
|
||||
GrClipMaskManager(GrDrawTarget* owner);
|
||||
|
||||
/**
|
||||
* Creates a clip mask if necessary as a stencil buffer or alpha texture
|
||||
@ -64,12 +65,8 @@ public:
|
||||
* then the draw can be skipped. devBounds is optional but can help optimize
|
||||
* clipping.
|
||||
*/
|
||||
bool setupClipping(const GrPipelineBuilder&, const SkRect* devBounds, GrAppliedClip*);
|
||||
|
||||
bool setupScissorClip(const GrPipelineBuilder& pipelineBuilder,
|
||||
const SkIRect& scissor,
|
||||
const SkRect* devBounds,
|
||||
GrAppliedClip* out);
|
||||
bool setupClipping(const GrPipelineBuilder&, const GrClip&, const SkRect* devBounds,
|
||||
GrAppliedClip*);
|
||||
|
||||
private:
|
||||
inline GrContext* getContext();
|
||||
@ -150,7 +147,6 @@ private:
|
||||
|
||||
GrDrawTarget* fDrawTarget; // This is our owning draw target.
|
||||
StencilClipMode fClipMode;
|
||||
bool fDebugClipBatchToBounds;
|
||||
|
||||
typedef SkNoncopyable INHERITED;
|
||||
};
|
||||
|
@ -235,8 +235,8 @@ void GrDrawContext::drawPaint(const GrClip& clip,
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(paint->getColor(), SkMatrix::I(), r, nullptr,
|
||||
&localMatrix));
|
||||
GrPipelineBuilder pipelineBuilder(*paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(*paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,14 +357,14 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
||||
}
|
||||
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
|
||||
if (snapToPixelCenters) {
|
||||
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
|
||||
snapToPixelCenters);
|
||||
}
|
||||
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
||||
this->internalDrawPath(clip, paint, viewMatrix, path, *style);
|
||||
}
|
||||
|
||||
bool GrDrawContextPriv::drawAndStencilRect(const SkIRect* scissorRect,
|
||||
bool GrDrawContextPriv::drawAndStencilRect(const GrClip& clip,
|
||||
const GrUserStencilSettings* ss,
|
||||
SkRegion::Op op,
|
||||
bool invert,
|
||||
@ -394,19 +394,17 @@ bool GrDrawContextPriv::drawAndStencilRect(const SkIRect* scissorRect,
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(fDrawContext->getFillRectBatch(paint, viewMatrix, rect));
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint,
|
||||
fDrawContext->accessRenderTarget(),
|
||||
GrClip::WideOpen());
|
||||
GrPipelineBuilder pipelineBuilder(paint, fDrawContext->accessRenderTarget());
|
||||
pipelineBuilder.setUserStencil(ss);
|
||||
|
||||
fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, batch, scissorRect);
|
||||
fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
return true;
|
||||
}
|
||||
|
||||
SkPath path;
|
||||
path.setIsVolatile(true);
|
||||
path.addRect(rect);
|
||||
return this->drawAndStencilPath(scissorRect, ss, op, invert, doAA, viewMatrix, path);
|
||||
return this->drawAndStencilPath(clip, ss, op, invert, doAA, viewMatrix, path);
|
||||
}
|
||||
|
||||
void GrDrawContext::fillRectToRect(const GrClip& clip,
|
||||
@ -432,8 +430,8 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
|
||||
}
|
||||
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->drawBatch(&pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->drawBatch(&pipelineBuilder, clip, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,8 +457,8 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
|
||||
nullptr, &localMatrix));
|
||||
}
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
void GrDrawContext::drawVertices(const GrClip& clip,
|
||||
@ -504,8 +502,8 @@ void GrDrawContext::drawVertices(const GrClip& clip,
|
||||
indexCount, colors, texCoords,
|
||||
bounds));
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -529,8 +527,8 @@ void GrDrawContext::drawAtlas(const GrClip& clip,
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount,
|
||||
xform, texRect, colors));
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -562,8 +560,8 @@ void GrDrawContext::drawRRect(const GrClip& clip,
|
||||
stroke,
|
||||
shaderCaps));
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -656,7 +654,6 @@ void GrDrawContext::drawDRRect(const GrClip& clip,
|
||||
path.addRRect(outer);
|
||||
path.setFillType(SkPath::kEvenOdd_FillType);
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->internalDrawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill());
|
||||
}
|
||||
|
||||
@ -688,8 +685,8 @@ void GrDrawContext::drawOval(const GrClip& clip,
|
||||
stroke,
|
||||
shaderCaps));
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -718,8 +715,8 @@ void GrDrawContext::drawImageNine(const GrClip& clip,
|
||||
imageWidth, imageHeight,
|
||||
center, dst));
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
|
||||
@ -778,8 +775,8 @@ void GrDrawContext::drawBatch(const GrClip& clip,
|
||||
|
||||
AutoCheckFlush acf(fDrawingManager);
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
void GrDrawContext::drawPath(const GrClip& clip,
|
||||
@ -810,8 +807,8 @@ void GrDrawContext::drawPath(const GrClip& clip,
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFillNestedRects(
|
||||
paint.getColor(), viewMatrix, rects));
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -827,8 +824,8 @@ void GrDrawContext::drawPath(const GrClip& clip,
|
||||
style.strokeRec(),
|
||||
shaderCaps));
|
||||
if (batch) {
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, clip, batch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -842,7 +839,7 @@ void GrDrawContext::drawPath(const GrClip& clip,
|
||||
this->internalDrawPath(clip, paint, viewMatrix, path, style);
|
||||
}
|
||||
|
||||
bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect,
|
||||
bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
|
||||
const GrUserStencilSettings* ss,
|
||||
SkRegion::Op op,
|
||||
bool invert,
|
||||
@ -855,7 +852,7 @@ bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect,
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::drawPath");
|
||||
|
||||
if (path.isEmpty() && path.isInverseFillType()) {
|
||||
this->drawAndStencilRect(scissorRect, ss, op, invert, false, SkMatrix::I(),
|
||||
this->drawAndStencilRect(clip, ss, op, invert, false, SkMatrix::I(),
|
||||
SkRect::MakeIWH(fDrawContext->width(),
|
||||
fDrawContext->height()));
|
||||
return true;
|
||||
@ -893,20 +890,14 @@ bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect,
|
||||
GrPaint paint;
|
||||
paint.setCoverageSetOpXPFactory(op, invert);
|
||||
|
||||
// TODO: it is unfortunate that we have to convert this to a GrClip to
|
||||
// call drawPath.
|
||||
GrClip clip;
|
||||
if (scissorRect) {
|
||||
clip.setIRect(*scissorRect);
|
||||
}
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fDrawContext->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fDrawContext->accessRenderTarget());
|
||||
pipelineBuilder.setUserStencil(ss);
|
||||
|
||||
GrPathRenderer::DrawPathArgs args;
|
||||
args.fTarget = fDrawContext->getDrawTarget();
|
||||
args.fResourceProvider = fDrawContext->fDrawingManager->getContext()->resourceProvider();
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &clip;
|
||||
args.fColor = GrColor_WHITE;
|
||||
args.fViewMatrix = &viewMatrix;
|
||||
args.fPath = &path;
|
||||
@ -1005,12 +996,13 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
|
||||
return;
|
||||
}
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget.get());
|
||||
|
||||
GrPathRenderer::DrawPathArgs args;
|
||||
args.fTarget = this->getDrawTarget();
|
||||
args.fResourceProvider = fDrawingManager->getContext()->resourceProvider();
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &clip;
|
||||
args.fColor = paint.getColor();
|
||||
args.fViewMatrix = &viewMatrix;
|
||||
args.fPath = canDrawArgs.fPath;
|
||||
@ -1020,11 +1012,12 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
|
||||
pr->drawPath(args);
|
||||
}
|
||||
|
||||
void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch) {
|
||||
void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, const GrClip& clip,
|
||||
GrDrawBatch* batch) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_IF_ABANDONED
|
||||
SkDEBUGCODE(this->validate();)
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
|
||||
|
||||
this->getDrawTarget()->drawBatch(*pipelineBuilder, batch);
|
||||
this->getDrawTarget()->drawBatch(*pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ struct GrUserStencilSettings;
|
||||
data members or virtual methods. */
|
||||
class GrDrawContextPriv {
|
||||
public:
|
||||
bool drawAndStencilRect(const SkIRect* scissorRect,
|
||||
bool drawAndStencilRect(const GrClip&,
|
||||
const GrUserStencilSettings*,
|
||||
SkRegion::Op op,
|
||||
bool invert,
|
||||
@ -25,7 +25,7 @@ public:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect&);
|
||||
|
||||
bool drawAndStencilPath(const SkIRect* scissorRect,
|
||||
bool drawAndStencilPath(const GrClip&,
|
||||
const GrUserStencilSettings*,
|
||||
SkRegion::Op op,
|
||||
bool invert,
|
||||
@ -34,7 +34,8 @@ public:
|
||||
const SkPath&);
|
||||
|
||||
void testingOnly_drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrDrawBatch* batch);
|
||||
GrDrawBatch* batch,
|
||||
const GrClip* = nullptr);
|
||||
|
||||
private:
|
||||
explicit GrDrawContextPriv(GrDrawContext* drawContext) : fDrawContext(drawContext) {}
|
||||
|
@ -46,8 +46,9 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
|
||||
, fRenderTarget(rt) {
|
||||
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
|
||||
fContext = fGpu->getContext();
|
||||
fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBounds));
|
||||
fClipMaskManager.reset(new GrClipMaskManager(this));
|
||||
|
||||
fClipBatchToBounds = options.fClipBatchToBounds;
|
||||
fDrawBatchBounds = options.fDrawBatchBounds;
|
||||
fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
|
||||
options.fMaxBatchLookback;
|
||||
@ -129,6 +130,7 @@ void GrDrawTarget::dump() const {
|
||||
#endif
|
||||
|
||||
bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
const GrPipelineOptimizations& optimizations,
|
||||
GrXferProcessor::DstTexture* dstTexture,
|
||||
const SkRect& batchBounds) {
|
||||
@ -152,7 +154,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
|
||||
}
|
||||
|
||||
SkIRect copyRect;
|
||||
pipelineBuilder.clip().getConservativeBounds(rt->width(), rt->height(), ©Rect);
|
||||
clip.getConservativeBounds(rt->width(), rt->height(), ©Rect);
|
||||
|
||||
SkIRect drawIBounds;
|
||||
bounds.roundOut(&drawIBounds);
|
||||
@ -233,40 +235,31 @@ void GrDrawTarget::reset() {
|
||||
}
|
||||
|
||||
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrDrawBatch* batch,
|
||||
const SkIRect* scissorRect) {
|
||||
const GrClip& clip,
|
||||
GrDrawBatch* batch) {
|
||||
// Setup clip
|
||||
GrAppliedClip clip;
|
||||
|
||||
if (scissorRect) {
|
||||
SkASSERT(GrClip::kWideOpen_ClipType == pipelineBuilder.clip().clipType());
|
||||
if (!fClipMaskManager->setupScissorClip(pipelineBuilder, *scissorRect,
|
||||
&batch->bounds(), &clip)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!fClipMaskManager->setupClipping(pipelineBuilder, &batch->bounds(), &clip)) {
|
||||
return;
|
||||
}
|
||||
GrAppliedClip appliedClip;
|
||||
if (!fClipMaskManager->setupClipping(pipelineBuilder, clip, &batch->bounds(), &appliedClip)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
|
||||
if (clip.clipCoverageFragmentProcessor()) {
|
||||
if (appliedClip.clipCoverageFragmentProcessor()) {
|
||||
arfps.set(&pipelineBuilder);
|
||||
arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
|
||||
arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProcessor());
|
||||
}
|
||||
|
||||
GrPipeline::CreateArgs args;
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fCaps = this->caps();
|
||||
args.fScissor = &clip.scissorState();
|
||||
args.fHasStencilClip = clip.hasStencilClip();
|
||||
if (pipelineBuilder.hasUserStencilSettings() || clip.hasStencilClip()) {
|
||||
args.fScissor = &appliedClip.scissorState();
|
||||
args.fHasStencilClip = appliedClip.hasStencilClip();
|
||||
if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()) {
|
||||
fResourceProvider->attachStencilAttachment(pipelineBuilder.getRenderTarget());
|
||||
}
|
||||
batch->getPipelineOptimizations(&args.fOpts);
|
||||
GrScissorState finalScissor;
|
||||
if (args.fOpts.fOverrides.fUsePLSDstRead) {
|
||||
if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) {
|
||||
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
|
||||
GrGLIRect viewport;
|
||||
viewport.fLeft = 0;
|
||||
@ -282,10 +275,10 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
viewport.fWidth);
|
||||
ibounds.fBottom = SkTPin(SkScalarCeilToInt(batch->bounds().fBottom), viewport.fBottom,
|
||||
viewport.fHeight);
|
||||
if (clip.scissorState().enabled()) {
|
||||
const SkIRect& scissorRect = clip.scissorState().rect();
|
||||
if (appliedClip.scissorState().enabled()) {
|
||||
const SkIRect& scissorRect = appliedClip.scissorState().rect();
|
||||
if (!ibounds.intersect(scissorRect)) {
|
||||
ibounds = scissorRect;
|
||||
return;
|
||||
}
|
||||
}
|
||||
finalScissor.set(ibounds);
|
||||
@ -296,7 +289,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
args.fOpts.fCoveragePOI.completeCalculations(
|
||||
pipelineBuilder.fCoverageFragmentProcessors.begin(),
|
||||
pipelineBuilder.numCoverageFragmentProcessors());
|
||||
if (!this->setupDstReadIfNecessary(pipelineBuilder, args.fOpts, &args.fDstTexture,
|
||||
if (!this->setupDstReadIfNecessary(pipelineBuilder, clip, args.fOpts, &args.fDstTexture,
|
||||
batch->bounds())) {
|
||||
return;
|
||||
}
|
||||
@ -314,6 +307,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
}
|
||||
|
||||
void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
const SkMatrix& viewMatrix,
|
||||
const GrPath* path,
|
||||
GrPathRendering::FillType fill) {
|
||||
@ -322,15 +316,16 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
|
||||
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
|
||||
|
||||
// Setup clip
|
||||
GrAppliedClip clip;
|
||||
if (!fClipMaskManager->setupClipping(pipelineBuilder, nullptr, &clip)) {
|
||||
GrAppliedClip appliedClip;
|
||||
if (!fClipMaskManager->setupClipping(pipelineBuilder, clip, nullptr, &appliedClip)) {
|
||||
return;
|
||||
}
|
||||
// TODO: respect fClipBatchToBounds if we ever start computing bounds here.
|
||||
|
||||
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
|
||||
if (clip.clipCoverageFragmentProcessor()) {
|
||||
if (appliedClip.clipCoverageFragmentProcessor()) {
|
||||
arfps.set(&pipelineBuilder);
|
||||
arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
|
||||
arfps.addCoverageFragmentProcessor(appliedClip.clipCoverageFragmentProcessor());
|
||||
}
|
||||
|
||||
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
|
||||
@ -339,9 +334,9 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
|
||||
pipelineBuilder.isHWAntialias(),
|
||||
fill,
|
||||
clip.hasStencilClip(),
|
||||
appliedClip.hasStencilClip(),
|
||||
stencilAttachment->bits(),
|
||||
clip.scissorState(),
|
||||
appliedClip.scissorState(),
|
||||
pipelineBuilder.getRenderTarget(),
|
||||
path);
|
||||
this->recordBatch(batch);
|
||||
@ -383,7 +378,7 @@ void GrDrawTarget::clear(const SkIRect* rect,
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(), scalarRect,
|
||||
nullptr, nullptr));
|
||||
this->drawBatch(pipelineBuilder, batch);
|
||||
this->drawBatch(pipelineBuilder, GrClip::WideOpen(), batch);
|
||||
} else {
|
||||
GrBatch* batch = new GrClearBatch(*rect, color, renderTarget);
|
||||
this->recordBatch(batch);
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
*/
|
||||
const GrCaps* caps() const { return fGpu->caps(); }
|
||||
|
||||
void drawBatch(const GrPipelineBuilder&, GrDrawBatch*, const SkIRect* scissorRect = nullptr);
|
||||
void drawBatch(const GrPipelineBuilder&, const GrClip&, GrDrawBatch*);
|
||||
|
||||
/**
|
||||
* Draws path into the stencil buffer. The fill must be either even/odd or
|
||||
@ -113,8 +113,8 @@ public:
|
||||
* on the GrPipelineBuilder (if possible in the 3D API). Note, we will never have an inverse
|
||||
* fill with stencil path
|
||||
*/
|
||||
void stencilPath(const GrPipelineBuilder&, const SkMatrix& viewMatrix, const GrPath*,
|
||||
GrPathRendering::FillType);
|
||||
void stencilPath(const GrPipelineBuilder&, const GrClip&, const SkMatrix& viewMatrix,
|
||||
const GrPath*, GrPathRendering::FillType);
|
||||
|
||||
/**
|
||||
* Clear the passed in render target. Ignores the GrPipelineBuilder and clip. Clears the whole
|
||||
@ -217,6 +217,7 @@ private:
|
||||
// but couldn't be made. Otherwise, returns true. This method needs to be protected because it
|
||||
// needs to be accessed by GLPrograms to setup a correct drawstate
|
||||
bool setupDstReadIfNecessary(const GrPipelineBuilder&,
|
||||
const GrClip&,
|
||||
const GrPipelineOptimizations& optimizations,
|
||||
GrXferProcessor::DstTexture*,
|
||||
const SkRect& batchBounds);
|
||||
@ -241,6 +242,7 @@ private:
|
||||
SkTDArray<GrDrawTarget*> fDependencies;
|
||||
GrRenderTarget* fRenderTarget;
|
||||
|
||||
bool fClipBatchToBounds;
|
||||
bool fDrawBatchBounds;
|
||||
int fMaxBatchLookback;
|
||||
int fMaxBatchLookahead;
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
* fTarget The target that the path will be rendered to
|
||||
* fResourceProvider The resource provider for creating gpu resources to render the path
|
||||
* fPipelineBuilder The pipelineBuilder
|
||||
* fClip The clip
|
||||
* fColor Color to render with
|
||||
* fViewMatrix The viewMatrix
|
||||
* fPath the path to draw.
|
||||
@ -122,6 +123,7 @@ public:
|
||||
GrDrawTarget* fTarget;
|
||||
GrResourceProvider* fResourceProvider;
|
||||
GrPipelineBuilder* fPipelineBuilder;
|
||||
const GrClip* fClip;
|
||||
GrColor fColor;
|
||||
const SkMatrix* fViewMatrix;
|
||||
const SkPath* fPath;
|
||||
@ -133,6 +135,7 @@ public:
|
||||
SkASSERT(fTarget);
|
||||
SkASSERT(fResourceProvider);
|
||||
SkASSERT(fPipelineBuilder);
|
||||
SkASSERT(fClip);
|
||||
SkASSERT(fViewMatrix);
|
||||
SkASSERT(fPath);
|
||||
SkASSERT(fStyle);
|
||||
@ -178,6 +181,7 @@ public:
|
||||
GrDrawTarget* fTarget;
|
||||
GrResourceProvider* fResourceProvider;
|
||||
GrPipelineBuilder* fPipelineBuilder;
|
||||
const GrClip* fClip;
|
||||
const SkMatrix* fViewMatrix;
|
||||
const SkPath* fPath;
|
||||
|
||||
|
@ -22,7 +22,7 @@ GrPipelineBuilder::GrPipelineBuilder()
|
||||
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
|
||||
}
|
||||
|
||||
GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, const GrClip& clip)
|
||||
GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt)
|
||||
: GrPipelineBuilder() {
|
||||
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
|
||||
|
||||
@ -38,8 +38,6 @@ GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, c
|
||||
|
||||
this->setRenderTarget(rt);
|
||||
|
||||
fClip = clip;
|
||||
|
||||
this->setState(GrPipelineBuilder::kHWAntialias_Flag,
|
||||
rt->isUnifiedMultisampled() && paint.isAntiAlias());
|
||||
this->setState(GrPipelineBuilder::kDisableOutputConversionToSRGB_Flag,
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "GrBlend.h"
|
||||
#include "GrCaps.h"
|
||||
#include "GrClip.h"
|
||||
#include "GrGpuResourceRef.h"
|
||||
#include "GrProcOptInfo.h"
|
||||
#include "GrRenderTarget.h"
|
||||
@ -37,7 +36,7 @@ public:
|
||||
* no GrPaint equivalents are set to default values with the exception of vertex attribute state
|
||||
* which is unmodified by this function and clipping which will be enabled.
|
||||
*/
|
||||
GrPipelineBuilder(const GrPaint&, GrRenderTarget*, const GrClip&);
|
||||
GrPipelineBuilder(const GrPaint&, GrRenderTarget*);
|
||||
|
||||
virtual ~GrPipelineBuilder();
|
||||
|
||||
@ -322,9 +321,6 @@ public:
|
||||
|
||||
bool usePLSDstRead(const GrDrawBatch* batch) const;
|
||||
|
||||
void setClip(const GrClip& clip) { fClip = clip; }
|
||||
const GrClip& clip() const { return fClip; }
|
||||
|
||||
private:
|
||||
// Some of the auto restore objects assume that no effects are removed during their lifetime.
|
||||
// This is used to assert that this condition holds.
|
||||
@ -339,7 +335,6 @@ private:
|
||||
mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
|
||||
FragmentProcessorArray fColorFragmentProcessors;
|
||||
FragmentProcessorArray fCoverageFragmentProcessors;
|
||||
GrClip fClip;
|
||||
|
||||
friend class GrPipeline;
|
||||
friend class GrDrawTarget;
|
||||
|
@ -322,6 +322,7 @@ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
|
||||
void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
|
||||
GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkIRect& rect) {
|
||||
@ -351,5 +352,5 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(),
|
||||
dstRect, nullptr, &invert));
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
target->drawBatch(*pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
static void DrawToTargetWithPathMask(GrTexture* texture,
|
||||
GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip&,
|
||||
GrColor,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkIRect& rect);
|
||||
|
@ -22,6 +22,7 @@ namespace {
|
||||
// path bounds will be a subset of the clip bounds. returns false if
|
||||
// path bounds would be empty.
|
||||
bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
const SkPath& path,
|
||||
const SkMatrix& matrix,
|
||||
SkIRect* devPathBounds,
|
||||
@ -32,7 +33,7 @@ bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
|
||||
return false;
|
||||
}
|
||||
|
||||
pipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), devClipBounds);
|
||||
clip.getConservativeBounds(rt->width(), rt->height(), devClipBounds);
|
||||
|
||||
if (devClipBounds->isEmpty()) {
|
||||
*devPathBounds = SkIRect::MakeWH(rt->width(), rt->height());
|
||||
@ -60,17 +61,19 @@ bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void draw_non_aa_rect(GrDrawTarget* drawTarget,
|
||||
const GrPipelineBuilder& pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkMatrix& localMatrix) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
|
||||
nullptr, &localMatrix));
|
||||
drawTarget->drawBatch(pipelineBuilder, batch);
|
||||
drawTarget->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
void draw_around_inv_path(GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkIRect& devClipBounds,
|
||||
@ -84,22 +87,22 @@ void draw_around_inv_path(GrDrawTarget* target,
|
||||
if (devClipBounds.fTop < devPathBounds.fTop) {
|
||||
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
|
||||
devClipBounds.fRight, devPathBounds.fTop);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, clip, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fLeft < devPathBounds.fLeft) {
|
||||
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
|
||||
devPathBounds.fLeft, devPathBounds.fBottom);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, clip, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fRight > devPathBounds.fRight) {
|
||||
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
|
||||
devClipBounds.fRight, devPathBounds.fBottom);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, clip, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fBottom > devPathBounds.fBottom) {
|
||||
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
|
||||
devClipBounds.fRight, devClipBounds.fBottom);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, clip, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,10 +117,10 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
}
|
||||
|
||||
SkIRect devPathBounds, devClipBounds;
|
||||
if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fPath,
|
||||
if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fClip, *args.fPath,
|
||||
*args.fViewMatrix, &devPathBounds, &devClipBounds)) {
|
||||
if (args.fPath->isInverseFillType()) {
|
||||
draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor,
|
||||
draw_around_inv_path(args.fTarget, args.fPipelineBuilder, *args.fClip, args.fColor,
|
||||
*args.fViewMatrix, devClipBounds, devPathBounds);
|
||||
}
|
||||
return true;
|
||||
@ -132,11 +135,12 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
}
|
||||
|
||||
GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipelineBuilder,
|
||||
args.fColor, *args.fViewMatrix, devPathBounds);
|
||||
*args.fClip, args.fColor, *args.fViewMatrix,
|
||||
devPathBounds);
|
||||
|
||||
if (args.fPath->isInverseFillType()) {
|
||||
draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, *args.fViewMatrix,
|
||||
devClipBounds, devPathBounds);
|
||||
draw_around_inv_path(args.fTarget, args.fPipelineBuilder, *args.fClip, args.fColor,
|
||||
*args.fViewMatrix, devClipBounds, devPathBounds);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1006,7 +1006,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
geometry.fPath = *args.fPath;
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(AAConvexPathBatch::Create(geometry));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -564,7 +564,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
*args.fViewMatrix, fAtlas,
|
||||
&fPathCache, &fPathList,
|
||||
args.fGammaCorrect));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -966,11 +966,11 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrAAHairlinePathRenderer::onDrawPath");
|
||||
SkIRect devClipBounds;
|
||||
GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
|
||||
args.fPipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), &devClipBounds);
|
||||
args.fClip->getConservativeBounds(rt->width(), rt->height(), &devClipBounds);
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, *args.fPath,
|
||||
*args.fStyle, devClipBounds));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
geometry.fMiterLimit = args.fStyle->strokeRec().getMiter();
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -33,6 +33,6 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
return false;
|
||||
}
|
||||
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
return true;
|
||||
}
|
||||
|
@ -419,6 +419,7 @@ private:
|
||||
|
||||
bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkPath& path,
|
||||
@ -573,7 +574,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
|
||||
&localMatrix));
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
target->drawBatch(*pipelineBuilder, clip, batch);
|
||||
} else {
|
||||
if (passCount > 1) {
|
||||
pipelineBuilder->setDisableColorXPFactory();
|
||||
@ -588,7 +589,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
viewMatrix, isHairline,
|
||||
devBounds));
|
||||
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
target->drawBatch(*pipelineBuilder, clip, batch);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -606,6 +607,7 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), "GrDefaultPathRenderer::onDrawPath");
|
||||
return this->internalDrawPath(args.fTarget,
|
||||
args.fPipelineBuilder,
|
||||
*args.fClip,
|
||||
args.fColor,
|
||||
*args.fViewMatrix,
|
||||
*args.fPath,
|
||||
@ -617,8 +619,8 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrDefaultPathRenderer::onStencilPath");
|
||||
SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
|
||||
SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
|
||||
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix,
|
||||
*args.fPath, GrStyle::SimpleFill(), true);
|
||||
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, *args.fClip, GrColor_WHITE,
|
||||
*args.fViewMatrix, *args.fPath, GrStyle::SimpleFill(), true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
|
||||
bool internalDrawPath(GrDrawTarget*,
|
||||
GrPipelineBuilder*,
|
||||
const GrClip&,
|
||||
GrColor,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkPath&,
|
||||
|
@ -568,6 +568,7 @@ private:
|
||||
|
||||
bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkPath& path,
|
||||
@ -676,7 +677,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
|
||||
&localMatrix));
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
target->drawBatch(*pipelineBuilder, clip, batch);
|
||||
} else {
|
||||
if (passCount > 1) {
|
||||
pipelineBuilder->setDisableColorXPFactory();
|
||||
@ -690,7 +691,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
SkAutoTUnref<MSAAPathBatch> batch(MSAAPathBatch::Create(geometry, viewMatrix,
|
||||
devBounds));
|
||||
if (batch->isValid()) {
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
target->drawBatch(*pipelineBuilder, clip, batch);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@ -728,6 +729,7 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
}
|
||||
return this->internalDrawPath(args.fTarget,
|
||||
args.fPipelineBuilder,
|
||||
*args.fClip,
|
||||
args.fColor,
|
||||
*args.fViewMatrix,
|
||||
*path,
|
||||
@ -738,8 +740,8 @@ void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer::onStencilPath");
|
||||
SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
|
||||
SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
|
||||
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix,
|
||||
*args.fPath, true);
|
||||
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, *args.fClip, GrColor_WHITE,
|
||||
*args.fViewMatrix, *args.fPath, true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -23,6 +23,7 @@ private:
|
||||
|
||||
bool internalDrawPath(GrDrawTarget*,
|
||||
GrPipelineBuilder*,
|
||||
const GrClip&,
|
||||
GrColor,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkPath&,
|
||||
|
@ -985,7 +985,7 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
geometry.fPath = *args.fPath;
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(PLSPathBatch::Create(geometry));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
SkDEBUGCODE(inPLSDraw = false;)
|
||||
return true;
|
||||
|
@ -69,7 +69,8 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
||||
"GrStencilAndCoverPathRenderer::onStencilPath");
|
||||
SkASSERT(!args.fPath->isInverseFillType());
|
||||
SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fPath, GrStyle::SimpleFill()));
|
||||
args.fTarget->stencilPath(*args.fPipelineBuilder, *args.fViewMatrix, p, p->getFillType());
|
||||
args.fTarget->stencilPath(*args.fPipelineBuilder, *args.fClip, *args.fViewMatrix, p,
|
||||
p->getFillType());
|
||||
}
|
||||
|
||||
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
@ -107,7 +108,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
pipelineBuilder->setUserStencil(&kInvertedCoverPass);
|
||||
|
||||
// fake inverse with a stencil and cover
|
||||
args.fTarget->stencilPath(*pipelineBuilder, viewMatrix, p, p->getFillType());
|
||||
args.fTarget->stencilPath(*pipelineBuilder, *args.fClip, viewMatrix, p, p->getFillType());
|
||||
|
||||
SkMatrix invert = SkMatrix::I();
|
||||
SkRect bounds =
|
||||
@ -134,7 +135,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds, nullptr,
|
||||
&invert));
|
||||
args.fTarget->drawBatch(*pipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*pipelineBuilder, *args.fClip, batch);
|
||||
} else {
|
||||
static constexpr GrUserStencilSettings kCoverPass(
|
||||
GrUserStencilSettings::StaticInit<
|
||||
@ -149,7 +150,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
pipelineBuilder->setUserStencil(&kCoverPass);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p));
|
||||
args.fTarget->drawBatch(*pipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*pipelineBuilder, *args.fClip, batch);
|
||||
}
|
||||
|
||||
pipelineBuilder->disableUserStencil();
|
||||
|
@ -287,7 +287,7 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
}
|
||||
|
||||
SkIRect clipBoundsI;
|
||||
args.fPipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), &clipBoundsI);
|
||||
args.fClip->getConservativeBounds(rt->width(), rt->height(), &clipBoundsI);
|
||||
SkRect clipBounds = SkRect::Make(clipBoundsI);
|
||||
SkMatrix vmi;
|
||||
if (!args.fViewMatrix->invert(&vmi)) {
|
||||
@ -297,7 +297,7 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fPath,
|
||||
*args.fStyle, *args.fViewMatrix,
|
||||
clipBounds));
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
|
||||
args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -300,8 +300,8 @@ inline GrDrawBatch* GrAtlasTextBlob::createBatch(
|
||||
|
||||
inline
|
||||
void GrAtlasTextBlob::flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBuilder,
|
||||
int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
|
||||
GrColor color,
|
||||
const GrClip& clip, int run, const SkMatrix& viewMatrix, SkScalar x,
|
||||
SkScalar y, GrColor color,
|
||||
const SkPaint& skPaint, const SkSurfaceProps& props,
|
||||
const GrDistanceFieldAdjustTable* distanceAdjustTable,
|
||||
GrBatchFontCache* cache) {
|
||||
@ -317,7 +317,7 @@ void GrAtlasTextBlob::flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBui
|
||||
skPaint, props,
|
||||
distanceAdjustTable, dc->isGammaCorrect(),
|
||||
cache));
|
||||
dc->drawBatch(pipelineBuilder, batch);
|
||||
dc->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,7 +416,7 @@ void GrAtlasTextBlob::flushCached(GrContext* context,
|
||||
SkScalar x, SkScalar y) {
|
||||
// We loop through the runs of the blob, flushing each. If any run is too large, then we flush
|
||||
// it as paths
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget());
|
||||
|
||||
GrColor color = grPaint.getColor();
|
||||
|
||||
@ -427,7 +427,7 @@ void GrAtlasTextBlob::flushCached(GrContext* context,
|
||||
drawFilter, viewMatrix, clipBounds, x, y);
|
||||
continue;
|
||||
}
|
||||
this->flushRun(dc, &pipelineBuilder, run, viewMatrix, x, y, color, skPaint, props,
|
||||
this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props,
|
||||
distanceAdjustTable, context->getBatchFontCache());
|
||||
}
|
||||
|
||||
@ -445,11 +445,11 @@ void GrAtlasTextBlob::flushThrowaway(GrContext* context,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkIRect& clipBounds,
|
||||
SkScalar x, SkScalar y) {
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget());
|
||||
|
||||
GrColor color = grPaint.getColor();
|
||||
for (int run = 0; run < fRunCount; run++) {
|
||||
this->flushRun(dc, &pipelineBuilder, run, viewMatrix, x, y, color, skPaint, props,
|
||||
this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color, skPaint, props,
|
||||
distanceAdjustTable, context->getBatchFontCache());
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ private:
|
||||
void appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, const SkGlyph& skGlyph,
|
||||
SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
|
||||
|
||||
inline void flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBuilder,
|
||||
inline void flushRun(GrDrawContext* dc, GrPipelineBuilder* pipelineBuilder, const GrClip&,
|
||||
int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color,
|
||||
const SkPaint& skPaint, const SkSurfaceProps& props,
|
||||
const GrDistanceFieldAdjustTable* distanceAdjustTable,
|
||||
|
@ -82,9 +82,9 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d
|
||||
} else if (this->canDraw(skPaint, viewMatrix)) {
|
||||
if (skPaint.getTextSize() > 0) {
|
||||
TextRun run(skPaint);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget());
|
||||
run.setText(text, byteLength, x, y);
|
||||
run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
|
||||
run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMatrix, props, 0, 0,
|
||||
clipBounds, fFallbackTextContext, skPaint);
|
||||
}
|
||||
return;
|
||||
@ -117,9 +117,9 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext
|
||||
} else if (this->canDraw(skPaint, viewMatrix)) {
|
||||
if (skPaint.getTextSize() > 0) {
|
||||
TextRun run(skPaint);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget());
|
||||
run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
|
||||
run.draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, 0, 0,
|
||||
run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMatrix, props, 0, 0,
|
||||
clipBounds, fFallbackTextContext, skPaint);
|
||||
}
|
||||
return;
|
||||
@ -225,11 +225,11 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex
|
||||
}
|
||||
|
||||
const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget(), clip);
|
||||
GrPipelineBuilder pipelineBuilder(paint, dc->accessRenderTarget());
|
||||
|
||||
TextBlob::Iter iter(blob);
|
||||
for (TextRun* run = iter.get(); run; run = iter.next()) {
|
||||
run->draw(context, dc, &pipelineBuilder, paint.getColor(), viewMatrix, props, x, y,
|
||||
run->draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMatrix, props, x, y,
|
||||
clipBounds, fFallbackTextContext, skPaint);
|
||||
run->releaseGlyphCache();
|
||||
}
|
||||
@ -597,6 +597,7 @@ inline void GrStencilAndCoverTextContext::TextRun::appendGlyph(const SkGlyph& gl
|
||||
void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
|
||||
GrDrawContext* dc,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
const GrClip& clip,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkSurfaceProps& props,
|
||||
@ -643,7 +644,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
|
||||
GrPathRendering::kWinding_FillType, glyphs, fInstanceData,
|
||||
bounds));
|
||||
|
||||
dc->drawBatch(pipelineBuilder, batch);
|
||||
dc->drawBatch(pipelineBuilder, clip, batch);
|
||||
}
|
||||
|
||||
if (fFallbackTextBlob) {
|
||||
@ -653,9 +654,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
|
||||
fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fTextRatio);
|
||||
}
|
||||
|
||||
fallbackTextContext->drawTextBlob(ctx, dc, pipelineBuilder->clip(), fallbackSkPaint,
|
||||
viewMatrix, props, fFallbackTextBlob, x, y, nullptr,
|
||||
clipBounds);
|
||||
fallbackTextContext->drawTextBlob(ctx, dc, clip, fallbackSkPaint, viewMatrix, props,
|
||||
fFallbackTextBlob, x, y, nullptr, clipBounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ private:
|
||||
void setPosText(const char text[], size_t byteLength, const SkScalar pos[],
|
||||
int scalarsPerPosition, const SkPoint& offset);
|
||||
|
||||
void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, GrColor, const SkMatrix&,
|
||||
const SkSurfaceProps&,
|
||||
void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, const GrClip&, GrColor,
|
||||
const SkMatrix&, const SkSurfaceProps&,
|
||||
SkScalar x, SkScalar y, const SkIRect& clipBounds,
|
||||
GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const;
|
||||
|
||||
|
@ -331,9 +331,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
||||
// dummy scissor state
|
||||
GrScissorState scissor;
|
||||
|
||||
// wide open clip
|
||||
GrClip clip;
|
||||
|
||||
SkRandom random;
|
||||
static const int NUM_TESTS = 1024;
|
||||
for (int t = 0; t < NUM_TESTS; t++) {
|
||||
@ -347,7 +344,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
||||
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
pipelineBuilder.setRenderTarget(rt.get());
|
||||
pipelineBuilder.setClip(clip);
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
|
||||
SkASSERT(batch);
|
||||
@ -387,7 +383,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
||||
GrPipelineBuilder builder;
|
||||
builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
|
||||
builder.setRenderTarget(rt.get());
|
||||
builder.setClip(clip);
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(
|
||||
GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd));
|
||||
|
@ -243,6 +243,7 @@ static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, GrResourceProvider*
|
||||
GrPathRenderer::DrawPathArgs args;
|
||||
args.fTarget = dt;
|
||||
args.fPipelineBuilder = &pipelineBuilder;
|
||||
args.fClip = &GrClip::WideOpen();
|
||||
args.fResourceProvider = rp;
|
||||
args.fColor = GrColor_WHITE;
|
||||
args.fViewMatrix = &SkMatrix::I();
|
||||
|
@ -253,13 +253,15 @@ void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
|
||||
#define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->abandoned()) { return; }
|
||||
|
||||
void GrDrawContextPriv::testingOnly_drawBatch(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrDrawBatch* batch) {
|
||||
GrDrawBatch* batch,
|
||||
const GrClip* clip) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_IF_ABANDONED
|
||||
SkDEBUGCODE(fDrawContext->validate();)
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testingOnly_drawBatch");
|
||||
|
||||
fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
const GrClip& drawClip = clip ? *clip : GrClip::WideOpen();
|
||||
fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, drawClip, batch);
|
||||
}
|
||||
|
||||
#undef ASSERT_SINGLE_OWNER
|
||||
|
Loading…
Reference in New Issue
Block a user