aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMGpuGMTask.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-01-15 08:30:25 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-15 08:30:25 -0800
commit709d2c3e5062c5b57f91273bfc11a751f5b2bb88 (patch)
treeb997d8e2f4fcd0c289017586540c876a1cef9c96 /dm/DMGpuGMTask.cpp
parent8eadff1e8c9cdb8f941c893a4763c03f5f083c62 (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 Review URL: https://codereview.chromium.org/788243008
Diffstat (limited to 'dm/DMGpuGMTask.cpp')
-rw-r--r--dm/DMGpuGMTask.cpp67
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