2014-03-26 21:26:15 +00:00
|
|
|
#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"
|
|
|
|
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
|
|
|
|
// Ganesh is available. Yippee!
|
|
|
|
|
|
|
|
# include "GrContext.h"
|
|
|
|
# include "GrContextFactory.h"
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
|
|
|
static const bool kGPUDisabled = false;
|
|
|
|
|
|
|
|
static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory,
|
|
|
|
GrContextFactory::GLContextType type,
|
2014-06-30 13:36:31 +00:00
|
|
|
GrGLStandard gpuAPI,
|
2014-03-26 21:26:15 +00:00
|
|
|
SkImageInfo info,
|
|
|
|
int samples) {
|
Revert of introduce Props to surface (patchset #27 id:520001 of https://codereview.chromium.org/551463004/)
Reason for revert:
Broke call site in WebKit
Original issue's description:
> introduce Props to surface (work in progress)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3716fd067a5621bb94a6cb08d72afec8bf3aceda
R=robertphillips@google.com, bsalomon@google.com, jvanverth@google.com, bungeman@google.com, fmalita@google.com, vangelis@chromium.org, reed@google.com
TBR=bsalomon@google.com, bungeman@google.com, fmalita@google.com, jvanverth@google.com, reed@google.com, robertphillips@google.com, vangelis@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/583773004
2014-09-21 17:25:07 +00:00
|
|
|
return SkSurface::NewRenderTarget(grFactory->get(type, gpuAPI), info, samples);
|
2014-03-26 21:26:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#else// !SK_SUPPORT_GPU
|
|
|
|
|
|
|
|
// Ganesh is not available. Fake it.
|
|
|
|
|
2014-06-30 13:36:31 +00:00
|
|
|
enum GrGLStandard {
|
|
|
|
kNone_GrGLStandard,
|
|
|
|
kGL_GrGLStandard,
|
|
|
|
kGLES_GrGLStandard
|
|
|
|
};
|
|
|
|
|
2014-03-26 21:26:15 +00:00
|
|
|
class GrContextFactory {
|
|
|
|
public:
|
|
|
|
typedef int GLContextType;
|
|
|
|
|
|
|
|
static const GLContextType kANGLE_GLContextType = 0,
|
|
|
|
kDebug_GLContextType = 0,
|
|
|
|
kMESA_GLContextType = 0,
|
|
|
|
kNVPR_GLContextType = 0,
|
|
|
|
kNative_GLContextType = 0,
|
|
|
|
kNull_GLContextType = 0;
|
2014-07-15 15:27:06 +00:00
|
|
|
void destroyContexts() {}
|
2014-07-28 20:48:36 +00:00
|
|
|
|
|
|
|
void abandonContexts() {}
|
2014-03-26 21:26:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
|
|
|
static const bool kGPUDisabled = true;
|
|
|
|
|
|
|
|
static inline SkSurface* NewGpuSurface(GrContextFactory*,
|
|
|
|
GrContextFactory::GLContextType,
|
2014-06-30 13:36:31 +00:00
|
|
|
GrGLStandard,
|
2014-03-26 21:26:15 +00:00
|
|
|
SkImageInfo,
|
|
|
|
int) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif//SK_SUPPORT_GPU
|
|
|
|
|
|
|
|
#endif//DMGpuSupport_DEFINED
|