Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1166553002: Remove GrContext from GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove comment Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5adc68acf25bc4ec31fb610db04df4c06651d47b..71b5674543edebbd6a8ae9affc2f83cbb8f36fb2 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -11,12 +11,13 @@
#include "GrAARectRenderer.h"
#include "GrBatch.h"
#include "GrCaps.h"
-#include "GrContext.h"
+#include "GrGpu.h"
#include "GrPath.h"
#include "GrPipeline.h"
#include "GrMemoryPool.h"
#include "GrRectBatch.h"
#include "GrRenderTarget.h"
+#include "GrResourceProvider.h"
#include "GrRenderTargetPriv.h"
#include "GrSurfacePriv.h"
#include "GrTemplates.h"
@@ -27,15 +28,17 @@
////////////////////////////////////////////////////////////////////////////////
-#define DEBUG_INVAL_BUFFER 0xdeadcafe
-#define DEBUG_INVAL_START_IDX -1
-
-GrDrawTarget::GrDrawTarget(GrContext* context)
- : fContext(context)
- , fCaps(SkRef(context->caps()))
+GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
+ : fGpu(SkRef(gpu))
+ , fCaps(SkRef(gpu->caps()))
+ , fResourceProvider(resourceProvider)
, fGpuTraceMarkerCount(0)
, fFlushing(false) {
- SkASSERT(context);
+}
+
+GrDrawTarget::~GrDrawTarget() {
+ fGpu->unref();
+ fCaps->unref();
}
////////////////////////////////////////////////////////////////////////////////
@@ -93,8 +96,8 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
desc.fWidth = copyRect.width();
desc.fHeight = copyRect.height();
- SkAutoTUnref<GrTexture> copy(fContext->textureProvider()->refScratchTexture(desc,
- GrTextureProvider::kApprox_ScratchTexMatch));
+ SkAutoTUnref<GrTexture> copy(
+ fResourceProvider->refScratchTexture(desc, GrTextureProvider::kApprox_ScratchTexMatch));
if (!copy) {
SkDebugf("Failed to create temporary copy of destination texture.\n");
@@ -540,7 +543,9 @@ GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
}
///////////////////////////////////////////////////////////////////////////////
-GrClipTarget::GrClipTarget(GrContext* context) : INHERITED(context) {
+GrClipTarget::GrClipTarget(GrContext* context)
+ : INHERITED(context->getGpu(), context->resourceProvider())
+ , fContext(context) {
fClipMaskManager.reset(SkNEW_ARGS(GrClipMaskManager, (this)));
}
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698