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

Unified Diff: dm/DMGpuTask.cpp

Issue 178273002: Let DM run unit tests. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 10 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 | « dm/DMGpuTask.h ('k') | dm/DMReporter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMGpuTask.cpp
diff --git a/dm/DMGpuTask.cpp b/dm/DMGpuTask.cpp
index f787e2544f1eb9cb0715ca42f87f9e3445dd1fee..3a4708b8db255abe7ea94dae7a5c039039ea050b 100644
--- a/dm/DMGpuTask.cpp
+++ b/dm/DMGpuTask.cpp
@@ -18,6 +18,7 @@ GpuTask::GpuTask(const char* name,
GrContextFactory::GLContextType contextType,
int sampleCount)
: Task(reporter, taskRunner)
+ , fTaskRunner(taskRunner)
, fGM(gmFactory(NULL))
, fName(UnderJoin(fGM->shortName(), name))
, fExpectations(expectations)
@@ -26,24 +27,12 @@ GpuTask::GpuTask(const char* name,
, 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);
+ fColorType,
+ kPremul_SkAlphaType);
+ GrContext* gr = fTaskRunner->getGrContextFactory()->get(fContextType); // Owned by surface.
SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(gr, info, fSampleCount));
SkCanvas* canvas = surface->getCanvas();
« no previous file with comments | « dm/DMGpuTask.h ('k') | dm/DMReporter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698