aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-25 17:31:35 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-26 13:15:14 +0000
commit72152831a01f7b5d334eb0e6f4cd6d2422e3f6e6 (patch)
treefe6d4949b1625e3f39791feb2931bc654c7e1693 /src
parent98829b979119297bd9dbbe9313ba98ea0b3289af (diff)
Move GrDrawingManager pointer to GrSurfaceContext
Change-Id: Ic285b24b384bbf284cc680fe770433dd4d643833 Reviewed-on: https://skia-review.googlesource.com/7561 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp83
-rw-r--r--src/gpu/GrSurfaceContext.cpp3
-rw-r--r--src/gpu/GrTextureContext.cpp7
3 files changed, 46 insertions, 47 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 0dd7d97da3..f11f45e70d 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -42,16 +42,16 @@
#include "SkLatticeIter.h"
#include "SkMatrixPriv.h"
-#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == fDrawingManager->getContext())
+#define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this->drawingManager()->getContext())
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
#define ASSERT_SINGLE_OWNER_PRIV \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->fSingleOwner);)
-#define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return; }
-#define RETURN_IF_ABANDONED_PRIV if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; }
-#define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
-#define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return false; }
-#define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
+#define RETURN_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return; }
+#define RETURN_IF_ABANDONED_PRIV if (fRenderTargetContext->drawingManager()->wasAbandoned()) { return; }
+#define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return false; }
+#define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->drawingManager()->wasAbandoned()) { return false; }
+#define RETURN_NULL_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return nullptr; }
using gr_instanced::InstancedRendering;
@@ -67,7 +67,7 @@ private:
};
bool GrRenderTargetContext::wasAbandoned() const {
- return fDrawingManager->wasAbandoned();
+ return this->drawingManager()->wasAbandoned();
}
// In MDB mode the reffing of the 'getLastOpList' call's result allows in-progress
@@ -81,8 +81,7 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
const SkSurfaceProps* surfaceProps,
GrAuditTrail* auditTrail,
GrSingleOwner* singleOwner)
- : GrSurfaceContext(context, std::move(colorSpace), auditTrail, singleOwner)
- , fDrawingManager(drawingMgr)
+ : GrSurfaceContext(context, drawingMgr, std::move(colorSpace), auditTrail, singleOwner)
, fRenderTargetProxy(std::move(rtp))
, fOpList(SkSafeRef(fRenderTargetProxy->getLastRenderTargetOpList()))
, fInstancedPipelineInfo(fRenderTargetProxy.get())
@@ -125,7 +124,7 @@ GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
SkDEBUGCODE(this->validate();)
if (!fOpList || fOpList->isClosed()) {
- fOpList = fDrawingManager->newOpList(fRenderTargetProxy.get());
+ fOpList = this->drawingManager()->newOpList(fRenderTargetProxy.get());
}
return fOpList;
@@ -215,7 +214,7 @@ void GrRenderTargetContext::drawText(const GrClip& clip, const SkPaint& skPaint,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawText");
- GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
+ GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
atlasTextContext->drawText(fContext, this, clip, skPaint, viewMatrix, fSurfaceProps, text,
byteLength, x, y, clipBounds);
}
@@ -230,7 +229,7 @@ void GrRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& paint
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawPosText");
- GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
+ GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
atlasTextContext->drawPosText(fContext, this, clip, paint, viewMatrix, fSurfaceProps, text,
byteLength, pos, scalarsPerPosition, offset, clipBounds);
}
@@ -244,7 +243,7 @@ void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& pain
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawTextBlob");
- GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
+ GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
atlasTextContext->drawTextBlob(fContext, this, clip, paint, viewMatrix, fSurfaceProps, blob, x,
y, filter, clipBounds);
}
@@ -255,7 +254,7 @@ void GrRenderTargetContext::discard() {
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::discard");
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
// TODO: This needs to be fixed up since it ends the deferral of the GrRenderTarget.
sk_sp<GrRenderTarget> rt(
@@ -275,7 +274,7 @@ void GrRenderTargetContext::clear(const SkIRect* rect,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::clear");
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
this->internalClear(rect ? GrFixedClip(*rect) : GrFixedClip::Disabled(), color, canIgnoreRect);
}
@@ -286,7 +285,7 @@ void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const GrColor
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
"GrRenderTargetContext::absClear");
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
SkIRect rtRect = SkIRect::MakeWH(fRenderTargetContext->fRenderTargetProxy->worstCaseWidth(
*fRenderTargetContext->caps()),
@@ -346,7 +345,7 @@ void GrRenderTargetContextPriv::clear(const GrFixedClip& clip,
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
"GrRenderTargetContextPriv::clear");
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
fRenderTargetContext->internalClear(clip, color, canIgnoreClip);
}
@@ -437,7 +436,7 @@ void GrRenderTargetContext::drawPaint(const GrClip& clip,
return;
}
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
this->drawNonAAFilledRect(clip, std::move(paint), SkMatrix::I(), r, nullptr, &localMatrix,
nullptr, GrAAType::kNone);
@@ -568,7 +567,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
// Path effects should've been devolved to a path in SkGpuDevice
SkASSERT(!style->pathEffect());
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec& stroke = style->strokeRec();
if (stroke.getStyle() == SkStrokeRec::kFill_Style) {
@@ -684,7 +683,7 @@ void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool i
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
"GrRenderTargetContextPriv::clearStencilClip");
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
// TODO: This needs to be fixed up since it ends the deferral of the GrRenderTarget.
if (!fRenderTargetContext->accessRenderTarget()) {
return;
@@ -713,7 +712,7 @@ void GrRenderTargetContextPriv::stencilRect(const GrClip& clip,
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
"GrRenderTargetContext::stencilRect");
SkASSERT(GrAAType::kCoverage != aaType);
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
GrPaint paint;
paint.setXPFactory(GrDisableColorXPFactory::Get());
@@ -735,7 +734,7 @@ bool GrRenderTargetContextPriv::drawAndStencilRect(const GrClip& clip,
GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
"GrRenderTargetContext::drawAndStencilRect");
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
GrPaint paint;
paint.setCoverageSetOpXPFactory(op, invert);
@@ -767,7 +766,7 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip,
return;
}
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
GrAAType aaType;
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
@@ -826,7 +825,7 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
return;
}
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
GrAAType aaType;
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
@@ -885,7 +884,7 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawVertices");
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
// TODO clients should give us bounds
SkRect bounds;
@@ -918,7 +917,7 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawAtlas");
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
std::unique_ptr<GrDrawOp> op =
GrDrawAtlasOp::Make(paint.getColor(), viewMatrix, spriteCount, xform, texRect, colors);
@@ -957,7 +956,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
#endif
SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec stroke = style.strokeRec();
GrAAType aaType;
@@ -1013,7 +1012,7 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip,
SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec stroke = style.strokeRec();
// TODO: add instancing support?
@@ -1116,7 +1115,7 @@ void GrRenderTargetContext::drawDRRect(const GrClip& clip,
SkASSERT(!outer.isEmpty());
SkASSERT(!inner.isEmpty());
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
if (this->drawFilledDRRect(clip, std::move(paint), aa, viewMatrix, outer, inner)) {
return;
@@ -1186,7 +1185,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip,
SkASSERT(!style.pathEffect()); // this should've been devolved to a path in SkGpuDevice
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
const SkStrokeRec& stroke = style.strokeRec();
GrAAType aaType;
@@ -1264,7 +1263,7 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawImageLattice");
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
std::unique_ptr<GrDrawOp> op = GrLatticeOp::MakeNonAA(paint.getColor(), viewMatrix, imageWidth,
imageHeight, std::move(iter), dst);
@@ -1288,7 +1287,7 @@ void GrRenderTargetContext::prepareForExternalIO() {
ASSERT_OWNED_RESOURCE(rt);
- fDrawingManager->prepareSurfaceForExternalIO(rt.get());
+ this->drawingManager()->prepareSurfaceForExternalIO(rt.get());
}
void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip,
@@ -1374,7 +1373,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
return;
}
- AutoCheckFlush acf(fDrawingManager);
+ AutoCheckFlush acf(this->drawingManager());
GrAAType aaType = this->decideAAType(aa);
if (GrAAType::kCoverage == aaType && !style.pathEffect()) {
@@ -1435,7 +1434,7 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
return true;
}
- AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->drawingManager());
// An Assumption here is that path renderer would use some form of tweaking
// the src color (either the input alpha or in the frag shader) to implement
@@ -1447,14 +1446,14 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
GrShape shape(path, GrStyle::SimpleFill());
GrPathRenderer::CanDrawPathArgs canDrawArgs;
canDrawArgs.fShaderCaps =
- fRenderTargetContext->fDrawingManager->getContext()->caps()->shaderCaps();
+ fRenderTargetContext->drawingManager()->getContext()->caps()->shaderCaps();
canDrawArgs.fViewMatrix = &viewMatrix;
canDrawArgs.fShape = &shape;
canDrawArgs.fAAType = aaType;
canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
// Don't allow the SW renderer
- GrPathRenderer* pr = fRenderTargetContext->fDrawingManager->getPathRenderer(
+ GrPathRenderer* pr = fRenderTargetContext->drawingManager()->getPathRenderer(
canDrawArgs, false, GrPathRendererChain::DrawType::kStencilAndColor);
if (!pr) {
return false;
@@ -1464,7 +1463,7 @@ bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
paint.setCoverageSetOpXPFactory(op, invert);
GrPathRenderer::DrawPathArgs args{
- fRenderTargetContext->fDrawingManager->getContext()->resourceProvider(),
+ fRenderTargetContext->drawingManager()->getContext()->resourceProvider(),
std::move(paint),
ss,
fRenderTargetContext,
@@ -1508,7 +1507,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
aaType = GrAAType::kCoverage;
}
GrPathRenderer::CanDrawPathArgs canDrawArgs;
- canDrawArgs.fShaderCaps = fDrawingManager->getContext()->caps()->shaderCaps();
+ canDrawArgs.fShaderCaps = this->drawingManager()->getContext()->caps()->shaderCaps();
canDrawArgs.fViewMatrix = &viewMatrix;
canDrawArgs.fShape = &shape;
canDrawArgs.fHasUserStencilSettings = false;
@@ -1524,7 +1523,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
canDrawArgs.fAAType = aaType;
// Try a 1st time without applying any of the style to the geometry (and barring sw)
- pr = fDrawingManager->getPathRenderer(canDrawArgs, false, kType);
+ pr = this->drawingManager()->getPathRenderer(canDrawArgs, false, kType);
SkScalar styleScale = GrStyle::MatrixToScaleFactor(viewMatrix);
if (!pr && shape.style().pathEffect()) {
@@ -1533,7 +1532,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
if (shape.isEmpty()) {
return;
}
- pr = fDrawingManager->getPathRenderer(canDrawArgs, false, kType);
+ pr = this->drawingManager()->getPathRenderer(canDrawArgs, false, kType);
}
if (!pr) {
if (shape.style().applies()) {
@@ -1543,7 +1542,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
}
}
// This time, allow SW renderer
- pr = fDrawingManager->getPathRenderer(canDrawArgs, true, kType);
+ pr = this->drawingManager()->getPathRenderer(canDrawArgs, true, kType);
}
if (!pr && GrAATypeIsHW(aaType)) {
// There are exceptional cases where we may wind up falling back to coverage based AA
@@ -1561,7 +1560,7 @@ void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
return;
}
- GrPathRenderer::DrawPathArgs args{fDrawingManager->getContext()->resourceProvider(),
+ GrPathRenderer::DrawPathArgs args{this->drawingManager()->getContext()->resourceProvider(),
std::move(paint),
&GrUserStencilSettings::kUnused,
this,
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index f8c1cbcc27..7e4d4fb4b5 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -15,6 +15,7 @@
// stack. When this occurs with a closed GrOpList, a new one will be allocated
// when the renderTargetContext attempts to use it (via getOpList).
GrSurfaceContext::GrSurfaceContext(GrContext* context,
+ GrDrawingManager* drawingMgr,
sk_sp<SkColorSpace> colorSpace,
GrAuditTrail* auditTrail,
GrSingleOwner* singleOwner)
@@ -24,5 +25,5 @@ GrSurfaceContext::GrSurfaceContext(GrContext* context,
#ifdef SK_DEBUG
, fSingleOwner(singleOwner)
#endif
-{
+ , fDrawingManager(drawingMgr) {
}
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 7ca1e54bef..0449c08281 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -14,7 +14,7 @@
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
-#define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
+#define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return false; }
GrTextureContext::GrTextureContext(GrContext* context,
GrDrawingManager* drawingMgr,
@@ -22,8 +22,7 @@ GrTextureContext::GrTextureContext(GrContext* context,
sk_sp<SkColorSpace> colorSpace,
GrAuditTrail* auditTrail,
GrSingleOwner* singleOwner)
- : GrSurfaceContext(context, std::move(colorSpace), auditTrail, singleOwner)
- , fDrawingManager(drawingMgr)
+ : GrSurfaceContext(context, drawingMgr, std::move(colorSpace), auditTrail, singleOwner)
, fTextureProxy(std::move(textureProxy))
, fOpList(SkSafeRef(fTextureProxy->getLastTextureOpList())) {
SkDEBUGCODE(this->validate();)
@@ -56,7 +55,7 @@ GrTextureOpList* GrTextureContext::getOpList() {
SkDEBUGCODE(this->validate();)
if (!fOpList || fOpList->isClosed()) {
- fOpList = fDrawingManager->newOpList(fTextureProxy.get());
+ fOpList = this->drawingManager()->newOpList(fTextureProxy.get());
}
return fOpList;