skia2/dm/DMGpuSupport.h
bsalomon b4b4cf36c6 Revert of Rename enums in GrContextFactory to remove "GL" (patchset #4 id:60001 of https://codereview.chromium.org/1845923004/ )
Reason for revert:
Many GM images unexpectedly changed with this CL.

Original issue's description:
> Rename enums in GrContextFactory to remove "GL"
>
> Also, remove kNative as a separate context type and instead make it an alias for kGL or kGLES based on OS.
>
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845923004
>
> Committed: https://skia.googlesource.com/skia/+/2d9c6f81353597aebf5934547e5cba7a872196fb

TBR=egdaniel@google.com,jvanverth@google.com
# Not skipping CQ checks because original CL landed more than 1 days ago.

Review URL: https://codereview.chromium.org/1856703002
2016-04-04 05:56:59 -07:00

110 lines
3.1 KiB
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef DMGpuSupport_DEFINED
#define DMGpuSupport_DEFINED
// Provides Ganesh to DM,
// or if it's not available, fakes it enough so most code doesn't have to know that.
#include "SkSurface.h"
// This should be safe to include even in no-gpu builds. Include by relative path so it
// can be found in non-gpu builds.
#include "../include/gpu/GrContextOptions.h"
#if SK_SUPPORT_GPU
// Ganesh is available. Yippee!
# include "GrContext.h"
# include "GrContextFactory.h"
namespace DM {
static const bool kGPUDisabled = false;
static inline sk_sp<SkSurface> NewGpuSurface(
sk_gpu_test::GrContextFactory* grFactory,
sk_gpu_test::GrContextFactory::GLContextType type,
sk_gpu_test::GrContextFactory::GLContextOptions options,
SkImageInfo info,
int samples,
bool useDIText) {
uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
return SkSurface::MakeRenderTarget(grFactory->get(type, options), SkBudgeted::kNo,
info, samples, &props);
}
} // namespace DM
#else// !SK_SUPPORT_GPU
// Ganesh is not available. Fake it.
enum GrGLStandard {
kNone_GrGLStandard,
kGL_GrGLStandard,
kGLES_GrGLStandard
};
static const int kGrGLStandardCnt = 3;
class GrContext {
public:
void dumpCacheStats(SkString*) const {}
void dumpGpuStats(SkString*) const {}
};
namespace sk_gpu_test {
class GrContextFactory {
public:
GrContextFactory() {};
explicit GrContextFactory(const GrContextOptions&) {}
typedef int GLContextType;
static const GLContextType kANGLE_GLContextType = 0,
kANGLE_GL_GLContextType = 0,
kCommandBuffer_GLContextType = 0,
kDebug_GLContextType = 0,
kMESA_GLContextType = 0,
kNVPR_GLContextType = 0,
kNative_GLContextType = 0,
kNull_GLContextType = 0;
static const int kGLContextTypeCnt = 1;
enum GLContextOptions {
kNone_GLContextOptions = 0,
kEnableNVPR_GLContextOptions = 0x1,
};
void destroyContexts() {}
void abandonContexts() {}
void releaseResourcesAndAbandonContexts() {}
};
} // namespace sk_gpu_test
namespace DM {
static const bool kGPUDisabled = true;
static inline SkSurface* NewGpuSurface(sk_gpu_test::GrContextFactory*,
sk_gpu_test::GrContextFactory::GLContextType,
sk_gpu_test::GrContextFactory::GLContextOptions,
SkImageInfo,
int,
bool) {
return nullptr;
}
} // namespace DM
#endif//SK_SUPPORT_GPU
#endif//DMGpuSupport_DEFINED