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