diff options
author | 2015-01-15 10:56:12 -0800 | |
---|---|---|
committer | 2015-01-15 10:56:12 -0800 | |
commit | 748ca3bf2d170708f263693e8579e6722389d0ef (patch) | |
tree | d35f621f82ec6addff9639fc60ab4937004e5243 /dm/DMGpuGMTask.cpp | |
parent | 0063a9b69a6a5d377f207c2aa1ea1e7220c19ba9 (diff) |
Sketch DM refactor.
BUG=skia:3255
I think this supports everything DM used to, but has completely refactored how
it works to fit the design in the bug.
Configs like "tiles-gpu" are automatically wired up.
I wouldn't suggest looking at this as a diff. There's just a bunch of deleted
files, a few new files, and one new file that shares a name with a deleted file
(DM.cpp).
NOTREECHECKS=true
Committed: https://skia.googlesource.com/skia/+/709d2c3e5062c5b57f91273bfc11a751f5b2bb88
Review URL: https://codereview.chromium.org/788243008
Diffstat (limited to 'dm/DMGpuGMTask.cpp')
-rw-r--r-- | dm/DMGpuGMTask.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/dm/DMGpuGMTask.cpp b/dm/DMGpuGMTask.cpp deleted file mode 100644 index 9347ebdfe9..0000000000 --- a/dm/DMGpuGMTask.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "DMGpuGMTask.h" -#include "DMUtil.h" -#include "DMWriteTask.h" -#include "SkCommonFlags.h" -#include "SkSurface.h" -#include "SkTLS.h" - -namespace DM { - -GpuGMTask::GpuGMTask(const char* config, - Reporter* reporter, - TaskRunner* taskRunner, - skiagm::GMRegistry::Factory gmFactory, - GrContextFactory::GLContextType contextType, - GrGLStandard gpuAPI, - int sampleCount, - bool useDFText) - : GpuTask(reporter, taskRunner) - , fGM(gmFactory(NULL)) - , fName(UnderJoin(fGM->getName(), config)) - , fContextType(contextType) - , fGpuAPI(gpuAPI) - , fSampleCount(sampleCount) - , fUseDFText(useDFText) - {} - -static bool gAlreadyWarned[GrContextFactory::kGLContextTypeCnt][kGrGLStandardCnt]; - -void GpuGMTask::draw(GrContextFactory* grFactory) { - SkImageInfo info = SkImageInfo::Make(SkScalarCeilToInt(fGM->width()), - SkScalarCeilToInt(fGM->height()), - kN32_SkColorType, - kPremul_SkAlphaType); - SkAutoTUnref<SkSurface> surface(NewGpuSurface(grFactory, fContextType, fGpuAPI, info, - fSampleCount, fUseDFText)); - if (!surface) { - if (!gAlreadyWarned[fContextType][fGpuAPI]) { - SkDebugf("FYI: couldn't create GPU context, type %d API %d. Will skip.\n", - fContextType, fGpuAPI); - gAlreadyWarned[fContextType][fGpuAPI] = true; - } - return; - } - SkCanvas* canvas = surface->getCanvas(); - CanvasPreflight(canvas); - - canvas->concat(fGM->getInitialTransform()); - fGM->draw(canvas); - canvas->flush(); -#if GR_CACHE_STATS && SK_SUPPORT_GPU - if (FLAGS_veryVerbose) { - grFactory->get(fContextType)->printCacheStats(); - } -#endif - - SkBitmap bitmap; - bitmap.setInfo(info); - canvas->readPixels(&bitmap, 0, 0); - - this->spawnChild(SkNEW_ARGS(WriteTask, (*this, "GM", bitmap))); -} - -bool GpuGMTask::shouldSkip() const { - return kGPUDisabled || SkToBool(fGM->getFlags() & skiagm::GM::kSkipGPU_Flag); -} - -} // namespace DM |