Pass a GrContext pointer in GrDrawContext constructor
authorjoshualitt <joshualitt@chromium.org>
Thu, 11 Feb 2016 14:46:52 +0000 (06:46 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 11 Feb 2016 14:46:52 +0000 (06:46 -0800)
TBR=bsalomon@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1691503002

Review URL: https://codereview.chromium.org/1691503002

include/gpu/GrDrawContext.h
src/gpu/GrDrawContext.cpp
src/gpu/GrDrawingManager.cpp

index 9276e2b21ff147e16ad69cc6f93d951d5c776433..24e38b84946dbcb1447f004ece5d6305527f9e38 100644 (file)
@@ -288,8 +288,8 @@ private:
 
     SkDEBUGCODE(void validate() const;)
 
-    GrDrawContext(GrDrawingManager*, GrRenderTarget*, const SkSurfaceProps* surfaceProps,
-                  GrAuditTrail*, GrSingleOwner*);
+    GrDrawContext(GrContext*, GrDrawingManager*, GrRenderTarget*,
+                  const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
 
     void internalDrawPath(GrPipelineBuilder*,
                           const SkMatrix& viewMatrix,
@@ -311,6 +311,7 @@ private:
     // it up. For this reason, the drawTarget should only ever be accessed via 'getDrawTarget'.
     GrDrawTarget*     fDrawTarget;
     GrTextContext*    fTextContext; // lazily gotten from GrContext::DrawingManager
+    GrContext*        fContext;
 
     SkSurfaceProps    fSurfaceProps;
     GrAuditTrail*     fAuditTrail;
index ed969f7e820a5e60bbd735aa6fc0d223f93cc0c4..be6eaf401d7e010f74080b17eb745d32f56241de 100644 (file)
@@ -50,7 +50,8 @@ private:
 // drawTargets to be picked up and added to by drawContexts lower in the call
 // stack. When this occurs with a closed drawTarget, a new one will be allocated
 // when the drawContext attempts to use it (via getDrawTarget).
-GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr,
+GrDrawContext::GrDrawContext(GrContext* context,
+                             GrDrawingManager* drawingMgr,
                              GrRenderTarget* rt,
                              const SkSurfaceProps* surfaceProps,
                              GrAuditTrail* auditTrail,
@@ -59,6 +60,7 @@ GrDrawContext::GrDrawContext(GrDrawingManager* drawingMgr,
     , fRenderTarget(rt)
     , fDrawTarget(SkSafeRef(rt->getLastDrawTarget()))
     , fTextContext(nullptr)
+    , fContext(context)
     , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
     , fAuditTrail(auditTrail)
 #ifdef SK_DEBUG
index 5b23b0c694708be0bd1c92f457037e078ee0a9dd..30bdfe1c3dd7c1886cb82c49027ac1b6da5e22e8 100644 (file)
@@ -196,5 +196,6 @@ GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
         return nullptr;
     }
 
-    return new GrDrawContext(this, rt, surfaceProps, fContext->getAuditTrail(), fSingleOwner);
+    return new GrDrawContext(fContext, this, rt, surfaceProps, fContext->getAuditTrail(),
+                             fSingleOwner);
 }