Index: dm/DMGpuTask.cpp |
diff --git a/dm/DMGpuTask.cpp b/dm/DMGpuTask.cpp |
index 3a4708b8db255abe7ea94dae7a5c039039ea050b..f787e2544f1eb9cb0715ca42f87f9e3445dd1fee 100644 |
--- a/dm/DMGpuTask.cpp |
+++ b/dm/DMGpuTask.cpp |
@@ -18,7 +18,6 @@ |
GrContextFactory::GLContextType contextType, |
int sampleCount) |
: Task(reporter, taskRunner) |
- , fTaskRunner(taskRunner) |
, fGM(gmFactory(NULL)) |
, fName(UnderJoin(fGM->shortName(), name)) |
, fExpectations(expectations) |
@@ -27,12 +26,24 @@ |
, fSampleCount(sampleCount) |
{} |
+static void* new_gr_context_factory() { |
+ return SkNEW(GrContextFactory); |
+} |
+ |
+static void delete_gr_context_factory(void* factory) { |
+ SkDELETE((GrContextFactory*) factory); |
+} |
+ |
+static GrContextFactory* get_gr_factory() { |
+ return reinterpret_cast<GrContextFactory*>(SkTLS::Get(&new_gr_context_factory, |
+ &delete_gr_context_factory)); |
+} |
+ |
void GpuTask::draw() { |
+ GrContext* gr = get_gr_factory()->get(fContextType); // Will be owned by device. |
SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()), |
SkScalarCeilToInt(fGM->height()), |
- fColorType, |
- kPremul_SkAlphaType); |
- GrContext* gr = fTaskRunner->getGrContextFactory()->get(fContextType); // Owned by surface. |
+ fColorType, kPremul_SkAlphaType); |
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(gr, info, fSampleCount)); |
SkCanvas* canvas = surface->getCanvas(); |