本文整理汇总了C++中SkNEW函数的典型用法代码示例。如果您正苦于以下问题:C++ SkNEW函数的具体用法?C++ SkNEW怎么用?C++ SkNEW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SkNEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onOnceBeforeDraw
//.........这里部分代码省略.........
canvas->drawCircle(radius, radius, radius, paint);
return SkRect::MakeXYWH(0, 0, 2 * radius, 2 * radius);
}
};
struct RRect : public Prim {
SkRect draw(SkCanvas* canvas, const SkPaint& paint) override {
SkRRect rrect;
rrect.setRectXY(SkRect::MakeXYWH(0, 0, 50, 50), 10, 10);
canvas->drawRRect(rrect, paint);
return rrect.getBounds();
}
};
struct DRRect : public Prim {
SkRect draw(SkCanvas* canvas, const SkPaint& paint) override {
SkRRect outerRRect;
outerRRect.setRectXY(SkRect::MakeXYWH(0, 0, 50, 50), 5, 5);
SkRRect innerRRect;
innerRRect.setRectXY(SkRect::MakeXYWH(5, 8, 35, 30), 8, 3);
canvas->drawDRRect(outerRRect, innerRRect, paint);
return outerRRect.getBounds();
}
};
struct Path : public Prim {
SkRect draw(SkCanvas* canvas, const SkPaint& paint) override {
SkPath path;
path.addCircle(15, 15, 10);
path.addOval(SkRect::MakeXYWH(2, 2, 22, 37));
path.setFillType(SkPath::kEvenOdd_FillType);
canvas->drawPath(path, paint);
return path.getBounds();
}
};
struct Points : public Prim {
Points(SkCanvas::PointMode mode) : fMode(mode) {}
SkRect draw(SkCanvas* canvas, const SkPaint& paint) override {
SkRandom random;
SkPoint points[500];
SkRect bounds = SkRect::MakeWH(50, 50);
int count = SkToInt(SK_ARRAY_COUNT(points));
if (SkCanvas::kPoints_PointMode != fMode) {
count = SkTMin(count, 10);
}
for (int p = 0; p < count; ++p) {
points[p].fX = random.nextUScalar1() * bounds.width();
points[p].fY = random.nextUScalar1() * bounds.width();
}
canvas->drawPoints(fMode, count, points, paint);
return bounds;
}
SkCanvas::PointMode fMode;
};
struct Text : public Prim {
SkRect draw(SkCanvas* canvas, const SkPaint& origPaint) override {
SkPaint paint = origPaint;
paint.setTextSize(30.f);
this->setFont(&paint);
const char* text = this->text();
static const SkVector offset = SkVector::Make(10, 10);
canvas->drawText(text, strlen(text), offset.fX, offset.fY, paint);
SkRect bounds;
paint.measureText(text, strlen(text), &bounds);
bounds.offset(offset);
return bounds;
}
virtual void setFont(SkPaint* paint) {
sk_tool_utils::set_portable_typeface(paint);
}
virtual const char* text() const { return "Hello, Skia!"; }
};
struct BmpText : public Text {
void setFont(SkPaint* paint) override {
if (!fTypeface) {
fTypeface.reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
}
paint->setTypeface(fTypeface);
}
const char* text() const override { return "Hi, Skia!"; }
SkAutoTUnref<SkTypeface> fTypeface;
};
fPrims.push_back(SkNEW(Rect));
fPrims.push_back(SkNEW(Circle));
fPrims.push_back(SkNEW(RRect));
fPrims.push_back(SkNEW(DRRect));
fPrims.push_back(SkNEW(Path));
fPrims.push_back(SkNEW(Points(SkCanvas::kPoints_PointMode)));
fPrims.push_back(SkNEW(Points(SkCanvas::kLines_PointMode)));
fPrims.push_back(SkNEW(Points(SkCanvas::kPolygon_PointMode)));
fPrims.push_back(SkNEW(Text));
fPrims.push_back(SkNEW(BmpText));
}
示例2: rtree_factory
static SkPicture* rtree_factory(const int width, const int height, int* recordingFlags) {
*recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
return SkNEW(SkPicture);
}
示例3: Create
static SkEmptyTypeface* Create() {
return SkNEW(SkEmptyTypeface);
}
示例4: onCreateFamilyNameIterator
SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const override {
return SkNEW(EmptyLocalizedStrings);
};
示例5: SkNEW
SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
return SkNEW(SkImageDecoder_WIC);
}
示例6: CreateProc
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW(SkSimpleColorFilter);
}
示例7: create_es_interface
static const GrGLInterface* create_es_interface(GrGLVersion version,
const GrGLExtensions& extensions) {
if (version < GR_GL_VER(2,0)) {
return NULL;
}
GrGLInterface* interface = SkNEW(GrGLInterface);
interface->fBindingsExported = kES_GrGLBinding;
interface->fActiveTexture = glActiveTexture;
interface->fAttachShader = glAttachShader;
interface->fBindAttribLocation = glBindAttribLocation;
interface->fBindBuffer = glBindBuffer;
interface->fBindTexture = glBindTexture;
interface->fBindVertexArray = glBindVertexArrayOES;
interface->fBlendColor = glBlendColor;
interface->fBlendFunc = glBlendFunc;
interface->fBufferData = glBufferData;
interface->fBufferSubData = glBufferSubData;
interface->fClear = glClear;
interface->fClearColor = glClearColor;
interface->fClearStencil = glClearStencil;
interface->fColorMask = glColorMask;
interface->fCompileShader = glCompileShader;
interface->fCompressedTexImage2D = glCompressedTexImage2D;
interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
interface->fCreateProgram = glCreateProgram;
interface->fCreateShader = glCreateShader;
interface->fCullFace = glCullFace;
interface->fDeleteBuffers = glDeleteBuffers;
interface->fDeleteProgram = glDeleteProgram;
interface->fDeleteShader = glDeleteShader;
interface->fDeleteTextures = glDeleteTextures;
interface->fDeleteVertexArrays = glDeleteVertexArraysOES;
interface->fDepthMask = glDepthMask;
interface->fDisable = glDisable;
interface->fDisableVertexAttribArray = glDisableVertexAttribArray;
interface->fDrawArrays = glDrawArrays;
interface->fDrawElements = glDrawElements;
interface->fEnable = glEnable;
interface->fEnableVertexAttribArray = glEnableVertexAttribArray;
interface->fFinish = glFinish;
interface->fFlush = glFlush;
interface->fFrontFace = glFrontFace;
interface->fGenBuffers = glGenBuffers;
interface->fGenerateMipmap = glGenerateMipmap;
interface->fGenTextures = glGenTextures;
interface->fGenVertexArrays = glGenVertexArraysOES;
interface->fGetBufferParameteriv = glGetBufferParameteriv;
interface->fGetError = glGetError;
interface->fGetIntegerv = glGetIntegerv;
interface->fGetProgramInfoLog = glGetProgramInfoLog;
interface->fGetProgramiv = glGetProgramiv;
interface->fGetShaderInfoLog = glGetShaderInfoLog;
interface->fGetShaderiv = glGetShaderiv;
interface->fGetString = glGetString;
#if GL_ES_VERSION_30
interface->fGetStringi = glGetStringi;
#else
interface->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");
#endif
interface->fGetUniformLocation = glGetUniformLocation;
interface->fLineWidth = glLineWidth;
interface->fLinkProgram = glLinkProgram;
interface->fPixelStorei = glPixelStorei;
interface->fReadPixels = glReadPixels;
interface->fScissor = glScissor;
#if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
#else
interface->fShaderSource = glShaderSource;
#endif
interface->fStencilFunc = glStencilFunc;
interface->fStencilFuncSeparate = glStencilFuncSeparate;
interface->fStencilMask = glStencilMask;
interface->fStencilMaskSeparate = glStencilMaskSeparate;
interface->fStencilOp = glStencilOp;
interface->fStencilOpSeparate = glStencilOpSeparate;
interface->fTexImage2D = glTexImage2D;
interface->fTexParameteri = glTexParameteri;
interface->fTexParameteriv = glTexParameteriv;
interface->fTexSubImage2D = glTexSubImage2D;
if (version >= GR_GL_VER(3,0)) {
#if GL_ES_VERSION_3_0
interface->fTexStorage2D = glTexStorage2D;
#else
interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D");
#endif
} else {
#if GL_EXT_texture_storage
interface->fTexStorage2D = glTexStorage2DEXT;
#else
interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
#endif
}
#if GL_EXT_discard_framebuffer
interface->fDiscardFramebuffer = glDiscardFramebufferEXT;
#endif
//.........这里部分代码省略.........
示例8: create_desktop_interface
static const GrGLInterface* create_desktop_interface(GrGLVersion version,
const GrGLExtensions& extensions) {
// Currently this assumes a 4.4 context or later. Supporting lower GL versions would require
// getting suffixed versions of pointers for supported extensions.
if (version < GR_GL_VER(4,4)) {
return NULL;
}
GrGLInterface* interface = SkNEW(GrGLInterface);
interface->fBindingsExported = kDesktop_GrGLBinding;
interface->fActiveTexture = (GrGLActiveTextureProc) eglGetProcAddress("glActiveTexture");
interface->fAttachShader = (GrGLAttachShaderProc) eglGetProcAddress("glAttachShader");
interface->fBeginQuery = (GrGLBeginQueryProc) eglGetProcAddress("glBeginQuery");
interface->fBindAttribLocation = (GrGLBindAttribLocationProc) eglGetProcAddress("glBindAttribLocation");
interface->fBindBuffer = (GrGLBindBufferProc) eglGetProcAddress("glBindBuffer");
interface->fBindFragDataLocation = (GrGLBindFragDataLocationProc) eglGetProcAddress("glBindFragDataLocation");
interface->fBindFragDataLocationIndexed = (GrGLBindFragDataLocationIndexedProc) eglGetProcAddress("glBindFragDataLocationIndexed");
interface->fBindFramebuffer = (GrGLBindFramebufferProc) eglGetProcAddress("glBindFramebuffer");
interface->fBindRenderbuffer = (GrGLBindRenderbufferProc) eglGetProcAddress("glBindRenderbuffer");
interface->fBindTexture = (GrGLBindTextureProc) eglGetProcAddress("glBindTexture");
interface->fBindVertexArray = (GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArray");
interface->fBlendColor = (GrGLBlendColorProc) eglGetProcAddress("glBlendColor");
interface->fBlendFunc = (GrGLBlendFuncProc) eglGetProcAddress("glBlendFunc");
interface->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAddress("glBlitFramebuffer");
interface->fBufferData = (GrGLBufferDataProc) eglGetProcAddress("glBufferData");
interface->fBufferSubData = (GrGLBufferSubDataProc) eglGetProcAddress("glBufferSubData");
interface->fCheckFramebufferStatus = (GrGLCheckFramebufferStatusProc) eglGetProcAddress("glCheckFramebufferStatus");
interface->fClear = (GrGLClearProc) eglGetProcAddress("glClear");
interface->fClearColor = (GrGLClearColorProc) eglGetProcAddress("glClearColor");
interface->fClearStencil = (GrGLClearStencilProc) eglGetProcAddress("glClearStencil");
interface->fClientActiveTexture = (GrGLClientActiveTextureProc) eglGetProcAddress("glClientActiveTexture");
interface->fColorMask = (GrGLColorMaskProc) eglGetProcAddress("glColorMask");
interface->fCompileShader = (GrGLCompileShaderProc) eglGetProcAddress("glCompileShader");
interface->fCompressedTexImage2D = (GrGLCompressedTexImage2DProc) eglGetProcAddress("glCompressedTexImage2D");
interface->fCopyTexSubImage2D = (GrGLCopyTexSubImage2DProc) eglGetProcAddress("glCopyTexSubImage2D");
interface->fCreateProgram = (GrGLCreateProgramProc) eglGetProcAddress("glCreateProgram");
interface->fCreateShader = (GrGLCreateShaderProc) eglGetProcAddress("glCreateShader");
interface->fCullFace = (GrGLCullFaceProc) eglGetProcAddress("glCullFace");
interface->fDeleteBuffers = (GrGLDeleteBuffersProc) eglGetProcAddress("glDeleteBuffers");
interface->fDeleteFramebuffers = (GrGLDeleteFramebuffersProc) eglGetProcAddress("glDeleteFramebuffers");
interface->fDeleteProgram = (GrGLDeleteProgramProc) eglGetProcAddress("glDeleteProgram");
interface->fDeleteQueries = (GrGLDeleteQueriesProc) eglGetProcAddress("glDeleteQueries");
interface->fDeleteRenderbuffers = (GrGLDeleteRenderbuffersProc) eglGetProcAddress("glDeleteRenderbuffers");
interface->fDeleteShader = (GrGLDeleteShaderProc) eglGetProcAddress("glDeleteShader");
interface->fDeleteTextures = (GrGLDeleteTexturesProc) eglGetProcAddress("glDeleteTextures");
interface->fDeleteVertexArrays = (GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArrays");
interface->fDepthMask = (GrGLDepthMaskProc) eglGetProcAddress("glDepthMask");
interface->fDisable = (GrGLDisableProc) eglGetProcAddress("glDisable");
interface->fDisableClientState = (GrGLDisableClientStateProc) eglGetProcAddress("glDisableClientState");
interface->fDisableVertexAttribArray = (GrGLDisableVertexAttribArrayProc) eglGetProcAddress("glDisableVertexAttribArray");
interface->fDrawArrays = (GrGLDrawArraysProc) eglGetProcAddress("glDrawArrays");
interface->fDrawBuffer = (GrGLDrawBufferProc) eglGetProcAddress("glDrawBuffer");
interface->fDrawBuffers = (GrGLDrawBuffersProc) eglGetProcAddress("glDrawBuffers");
interface->fDrawElements = (GrGLDrawElementsProc) eglGetProcAddress("glDrawElements");
interface->fEnable = (GrGLEnableProc) eglGetProcAddress("glEnable");
interface->fEnableClientState = (GrGLEnableClientStateProc) eglGetProcAddress("glEnableClientState");
interface->fEnableVertexAttribArray = (GrGLEnableVertexAttribArrayProc) eglGetProcAddress("glEnableVertexAttribArray");
interface->fEndQuery = (GrGLEndQueryProc) eglGetProcAddress("glEndQuery");
interface->fFinish = (GrGLFinishProc) eglGetProcAddress("glFinish");
interface->fFlush = (GrGLFlushProc) eglGetProcAddress("glFlush");
interface->fFramebufferRenderbuffer = (GrGLFramebufferRenderbufferProc) eglGetProcAddress("glFramebufferRenderbuffer");
interface->fFramebufferTexture2D = (GrGLFramebufferTexture2DProc) eglGetProcAddress("glFramebufferTexture2D");
interface->fFrontFace = (GrGLFrontFaceProc) eglGetProcAddress("glFrontFace");
interface->fGenBuffers = (GrGLGenBuffersProc) eglGetProcAddress("glGenBuffers");
interface->fGenFramebuffers = (GrGLGenFramebuffersProc) eglGetProcAddress("glGenFramebuffers");
interface->fGenerateMipmap = (GrGLGenerateMipmapProc) eglGetProcAddress("glGenerateMipmap");
interface->fGenQueries = (GrGLGenQueriesProc) eglGetProcAddress("glGenQueries");
interface->fGenRenderbuffers = (GrGLGenRenderbuffersProc) eglGetProcAddress("glGenRenderbuffers");
interface->fGenTextures = (GrGLGenTexturesProc) eglGetProcAddress("glGenTextures");
interface->fGenVertexArrays = (GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArrays");
interface->fGetBufferParameteriv = (GrGLGetBufferParameterivProc) eglGetProcAddress("glGetBufferParameteriv");
interface->fGetError = (GrGLGetErrorProc) eglGetProcAddress("glGetError");
interface->fGetFramebufferAttachmentParameteriv = (GrGLGetFramebufferAttachmentParameterivProc) eglGetProcAddress("glGetFramebufferAttachmentParameteriv");
interface->fGetIntegerv = (GrGLGetIntegervProc) eglGetProcAddress("glGetIntegerv");
interface->fGetQueryObjecti64v = (GrGLGetQueryObjecti64vProc) eglGetProcAddress("glGetQueryObjecti64v");
interface->fGetQueryObjectiv = (GrGLGetQueryObjectivProc) eglGetProcAddress("glGetQueryObjectiv");
interface->fGetQueryObjectui64v = (GrGLGetQueryObjectui64vProc) eglGetProcAddress("glGetQueryObjectui64v");
interface->fGetQueryObjectuiv = (GrGLGetQueryObjectuivProc) eglGetProcAddress("glGetQueryObjectuiv");
interface->fGetQueryiv = (GrGLGetQueryivProc) eglGetProcAddress("glGetQueryiv");
interface->fGetProgramInfoLog = (GrGLGetProgramInfoLogProc) eglGetProcAddress("glGetProgramInfoLog");
interface->fGetProgramiv = (GrGLGetProgramivProc) eglGetProcAddress("glGetProgramiv");
interface->fGetRenderbufferParameteriv = (GrGLGetRenderbufferParameterivProc) eglGetProcAddress("glGetRenderbufferParameteriv");
interface->fGetShaderInfoLog = (GrGLGetShaderInfoLogProc) eglGetProcAddress("glGetShaderInfoLog");
interface->fGetShaderiv = (GrGLGetShaderivProc) eglGetProcAddress("glGetShaderiv");
interface->fGetString = (GrGLGetStringProc) eglGetProcAddress("glGetString");
interface->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");
interface->fGetTexLevelParameteriv = (GrGLGetTexLevelParameterivProc) eglGetProcAddress("glGetTexLevelParameteriv");
interface->fGetUniformLocation = (GrGLGetUniformLocationProc) eglGetProcAddress("glGetUniformLocation");
interface->fLineWidth = (GrGLLineWidthProc) eglGetProcAddress("glLineWidth");
interface->fLinkProgram = (GrGLLinkProgramProc) eglGetProcAddress("glLinkProgram");
interface->fLoadIdentity = (GrGLLoadIdentityProc) eglGetProcAddress("glLoadIdentity");
interface->fLoadMatrixf = (GrGLLoadMatrixfProc) eglGetProcAddress("glLoadMatrixf");
interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBuffer");
interface->fMatrixMode = (GrGLMatrixModeProc) eglGetProcAddress("glMatrixMode");
interface->fPixelStorei = (GrGLPixelStoreiProc) eglGetProcAddress("glPixelStorei");
interface->fQueryCounter = (GrGLQueryCounterProc) eglGetProcAddress("glQueryCounter");
interface->fReadBuffer = (GrGLReadBufferProc) eglGetProcAddress("glReadBuffer");
interface->fReadPixels = (GrGLReadPixelsProc) eglGetProcAddress("glReadPixels");
interface->fRenderbufferStorage = (GrGLRenderbufferStorageProc) eglGetProcAddress("glRenderbufferStorage");
//.........这里部分代码省略.........
示例9: sk_remotable_font_identity_set_new
// As a template argument, this must have external linkage.
SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new() {
return SkNEW(SkRemotableFontIdentitySet);
}
示例10: create_es_interface
static GrGLInterface* create_es_interface(GrGLVersion version,
GrGLExtensions* extensions) {
if (version < GR_GL_VER(2,0)) {
return NULL;
}
GrGLInterface* interface = SkNEW(GrGLInterface);
interface->fStandard = kGLES_GrGLStandard;
GrGLInterface::Functions* functions = &interface->fFunctions;
functions->fActiveTexture = glActiveTexture;
functions->fAttachShader = glAttachShader;
functions->fBindAttribLocation = glBindAttribLocation;
functions->fBindBuffer = glBindBuffer;
functions->fBindTexture = glBindTexture;
functions->fBindVertexArray = (*(PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress("glBindVertexArrayOES"));// glBindVertexArrayOES;
functions->fBlendColor = glBlendColor;
functions->fBlendFunc = glBlendFunc;
functions->fBufferData = glBufferData;
functions->fBufferSubData = glBufferSubData;
functions->fClear = glClear;
functions->fClearColor = glClearColor;
functions->fClearStencil = glClearStencil;
functions->fColorMask = glColorMask;
functions->fCompileShader = glCompileShader;
functions->fCompressedTexImage2D = glCompressedTexImage2D;
functions->fCompressedTexSubImage2D = glCompressedTexSubImage2D;
functions->fCopyTexSubImage2D = glCopyTexSubImage2D;
functions->fCreateProgram = glCreateProgram;
functions->fCreateShader = glCreateShader;
functions->fCullFace = glCullFace;
functions->fDeleteBuffers = glDeleteBuffers;
functions->fDeleteProgram = glDeleteProgram;
functions->fDeleteShader = glDeleteShader;
functions->fDeleteTextures = glDeleteTextures;
functions->fDeleteVertexArrays = (*(PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"));
functions->fDepthMask = glDepthMask;
functions->fDisable = glDisable;
functions->fDisableVertexAttribArray = glDisableVertexAttribArray;
functions->fDrawArrays = glDrawArrays;
functions->fDrawElements = glDrawElements;
functions->fEnable = glEnable;
functions->fEnableVertexAttribArray = glEnableVertexAttribArray;
functions->fFinish = glFinish;
functions->fFlush = glFlush;
functions->fFrontFace = glFrontFace;
functions->fGenBuffers = glGenBuffers;
functions->fGenerateMipmap = glGenerateMipmap;
functions->fGenTextures = glGenTextures;
functions->fGenVertexArrays = (*(PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES"));
functions->fGetBufferParameteriv = glGetBufferParameteriv;
functions->fGetError = glGetError;
functions->fGetIntegerv = glGetIntegerv;
functions->fGetProgramInfoLog = glGetProgramInfoLog;
functions->fGetProgramiv = glGetProgramiv;
functions->fGetShaderInfoLog = glGetShaderInfoLog;
functions->fGetShaderiv = glGetShaderiv;
functions->fGetString = glGetString;
#if GL_ES_VERSION_3_0
functions->fGetStringi = glGetStringi;
#else
functions->fGetStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");
#endif
functions->fGetUniformLocation = glGetUniformLocation;
functions->fLineWidth = glLineWidth;
functions->fLinkProgram = glLinkProgram;
functions->fPixelStorei = glPixelStorei;
functions->fReadPixels = glReadPixels;
functions->fScissor = glScissor;
#if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
functions->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
#else
functions->fShaderSource = glShaderSource;
#endif
functions->fStencilFunc = glStencilFunc;
functions->fStencilFuncSeparate = glStencilFuncSeparate;
functions->fStencilMask = glStencilMask;
functions->fStencilMaskSeparate = glStencilMaskSeparate;
functions->fStencilOp = glStencilOp;
functions->fStencilOpSeparate = glStencilOpSeparate;
functions->fTexImage2D = glTexImage2D;
functions->fTexParameteri = glTexParameteri;
functions->fTexParameteriv = glTexParameteriv;
functions->fTexSubImage2D = glTexSubImage2D;
if (version >= GR_GL_VER(3,0)) {
#if GL_ES_VERSION_3_0
functions->fTexStorage2D = glTexStorage2D;
#else
functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2D");
#endif
} else {
#if GL_EXT_texture_storage
functions->fTexStorage2D = glTexStorage2DEXT;
#else
functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
#endif
}
#if GL_EXT_discard_framebuffer
//.........这里部分代码省略.........
示例11: SkNEW
GrGLXferProcessor* ShaderPDXferProcessor::createGLInstance() const {
return SkNEW(GLShaderPDXferProcessor);
}
示例12: parseRenderer
sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
error.reset();
if (FLAGS_multi <= 0) {
error.printf("--multi must be > 0, was %i", FLAGS_multi);
return NULL;
}
bool useTiles = false;
const char* widthString = NULL;
const char* heightString = NULL;
bool isPowerOf2Mode = false;
bool isCopyMode = false;
const char* mode = NULL;
bool gridSupported = false;
SkAutoTUnref<sk_tools::PictureRenderer> renderer;
if (FLAGS_mode.count() >= 1) {
mode = FLAGS_mode[0];
if (0 == strcmp(mode, "record")) {
renderer.reset(SkNEW(sk_tools::RecordPictureRenderer));
gridSupported = true;
// undocumented
} else if (0 == strcmp(mode, "clone")) {
renderer.reset(sk_tools::CreatePictureCloneRenderer());
} else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile")
|| 0 == strcmp(mode, "copyTile")) {
useTiles = true;
if (0 == strcmp(mode, "pow2tile")) {
isPowerOf2Mode = true;
} else if (0 == strcmp(mode, "copyTile")) {
isCopyMode = true;
} else {
gridSupported = true;
}
if (FLAGS_mode.count() < 2) {
error.printf("Missing width for --mode %s\n", mode);
return NULL;
}
widthString = FLAGS_mode[1];
if (FLAGS_mode.count() < 3) {
error.printf("Missing height for --mode %s\n", mode);
return NULL;
}
heightString = FLAGS_mode[2];
} else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool == tool) {
renderer.reset(SkNEW(sk_tools::PlaybackCreationRenderer));
gridSupported = true;
// undocumented
} else if (0 == strcmp(mode, "gatherPixelRefs") && kBench_PictureTool == tool) {
renderer.reset(sk_tools::CreateGatherPixelRefsRenderer());
} else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) {
renderer.reset(SkNEW(sk_tools::RecordPictureRenderer));
// Allow 'mode' to be set to 'simple', but do not create a renderer, so we can
// ensure that pipe does not override a mode besides simple. The renderer will
// be created below.
} else if (0 != strcmp(mode, "simple")) {
error.printf("%s is not a valid mode for --mode\n", mode);
return NULL;
}
}
if (useTiles) {
SkASSERT(NULL == renderer);
SkAutoTUnref<sk_tools::TiledPictureRenderer> tiledRenderer;
if (isCopyMode) {
int xTiles = -1;
int yTiles = -1;
if (FLAGS_tiles.count() > 0) {
if (FLAGS_tiles.count() != 2) {
error.printf("--tiles requires an x value and a y value.\n");
return NULL;
}
xTiles = atoi(FLAGS_tiles[0]);
yTiles = atoi(FLAGS_tiles[1]);
}
int x, y;
if (xTiles != -1 && yTiles != -1) {
x = xTiles;
y = yTiles;
if (x <= 0 || y <= 0) {
error.printf("--tiles must be given values > 0\n");
return NULL;
}
} else {
x = y = 4;
}
tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y)));
} else if (FLAGS_multi > 1) {
tiledRenderer.reset(SkNEW_ARGS(sk_tools::MultiCorePictureRenderer,
(FLAGS_multi)));
} else {
tiledRenderer.reset(SkNEW(sk_tools::TiledPictureRenderer));
}
//.........这里部分代码省略.........
示例13: GrGLCreateANGLEInterface
const GrGLInterface* GrGLCreateANGLEInterface() {
static HMODULE ghANGLELib = NULL;
if (NULL == ghANGLELib) {
// We load the ANGLE library and never let it go
ghANGLELib = LoadLibrary("libGLESv2.dll");
}
if (NULL == ghANGLELib) {
// We can't setup the interface correctly w/o the DLL
return NULL;
}
GrGLInterface* interface = SkNEW(GrGLInterface);
interface->fStandard = kGLES_GrGLStandard;
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
GET_PROC(AttachShader);
GET_PROC(BindAttribLocation);
GET_PROC(BindBuffer);
GET_PROC(BindTexture);
functions->fBindVertexArray =
(GrGLBindVertexArrayProc) eglGetProcAddress("glBindVertexArrayOES");
GET_PROC(BlendColor);
GET_PROC(BlendFunc);
GET_PROC(BufferData);
GET_PROC(BufferSubData);
GET_PROC(Clear);
GET_PROC(ClearColor);
GET_PROC(ClearStencil);
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
GET_PROC(CopyTexSubImage2D);
GET_PROC(CreateProgram);
GET_PROC(CreateShader);
GET_PROC(CullFace);
GET_PROC(DeleteBuffers);
GET_PROC(DeleteProgram);
GET_PROC(DeleteShader);
GET_PROC(DeleteTextures);
functions->fDeleteVertexArrays =
(GrGLDeleteVertexArraysProc) eglGetProcAddress("glDeleteVertexArraysOES");
GET_PROC(DepthMask);
GET_PROC(Disable);
GET_PROC(DisableVertexAttribArray);
GET_PROC(DrawArrays);
GET_PROC(DrawElements);
GET_PROC(Enable);
GET_PROC(EnableVertexAttribArray);
GET_PROC(Finish);
GET_PROC(Flush);
GET_PROC(FrontFace);
GET_PROC(GenBuffers);
GET_PROC(GenerateMipmap);
GET_PROC(GenTextures);
functions->fGenVertexArrays =
(GrGLGenVertexArraysProc) eglGetProcAddress("glGenVertexArraysOES");
GET_PROC(GetBufferParameteriv);
GET_PROC(GetError);
GET_PROC(GetIntegerv);
GET_PROC(GetProgramInfoLog);
GET_PROC(GetProgramiv);
GET_PROC(GetShaderInfoLog);
GET_PROC(GetShaderiv);
GET_PROC(GetString);
GET_PROC(GetUniformLocation);
GET_PROC(LineWidth);
GET_PROC(LinkProgram);
GET_PROC(PixelStorei);
GET_PROC(ReadPixels);
GET_PROC(Scissor);
GET_PROC(ShaderSource);
GET_PROC(StencilFunc);
GET_PROC(StencilFuncSeparate);
GET_PROC(StencilMask);
GET_PROC(StencilMaskSeparate);
GET_PROC(StencilOp);
GET_PROC(StencilOpSeparate);
GET_PROC(TexImage2D);
GET_PROC(TexParameteri);
GET_PROC(TexParameteriv);
GET_PROC(TexSubImage2D);
#if GL_ARB_texture_storage
GET_PROC(TexStorage2D);
#elif GL_EXT_texture_storage
functions->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
#endif
GET_PROC(Uniform1f);
GET_PROC(Uniform1i);
GET_PROC(Uniform1fv);
GET_PROC(Uniform1iv);
GET_PROC(Uniform2f);
GET_PROC(Uniform2i);
GET_PROC(Uniform2fv);
GET_PROC(Uniform2iv);
//.........这里部分代码省略.........
示例14: GrGLAssembleGLESInterface
const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
if (NULL == GetString) {
return NULL;
}
const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
GrGLVersion version = GrGLGetVersionFromString(verStr);
if (version < GR_GL_VER(2,0)) {
return NULL;
}
GET_PROC_LOCAL(GetIntegerv);
GET_PROC_LOCAL(GetStringi);
GrGLExtensions extensions;
if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
return NULL;
}
GrGLInterface* interface = SkNEW(GrGLInterface);
GrGLInterface::Functions* functions = &interface->fFunctions;
GET_PROC(ActiveTexture);
GET_PROC(AttachShader);
GET_PROC(BindAttribLocation);
GET_PROC(BindBuffer);
GET_PROC(BindTexture);
GET_PROC_SUFFIX(BindVertexArray, OES);
GET_PROC(BlendColor);
GET_PROC(BlendFunc);
GET_PROC(BufferData);
GET_PROC(BufferSubData);
GET_PROC(Clear);
GET_PROC(ClearColor);
GET_PROC(ClearStencil);
GET_PROC(ColorMask);
GET_PROC(CompileShader);
GET_PROC(CompressedTexImage2D);
GET_PROC(CompressedTexSubImage2D);
GET_PROC(CopyTexSubImage2D);
GET_PROC(CreateProgram);
GET_PROC(CreateShader);
GET_PROC(CullFace);
GET_PROC(DeleteBuffers);
GET_PROC(DeleteProgram);
GET_PROC(DeleteShader);
GET_PROC(DeleteTextures);
GET_PROC_SUFFIX(DeleteVertexArrays, OES);
GET_PROC(DepthMask);
GET_PROC(Disable);
GET_PROC(DisableVertexAttribArray);
GET_PROC(DrawArrays);
GET_PROC(DrawElements);
GET_PROC(Enable);
GET_PROC(EnableVertexAttribArray);
GET_PROC(Finish);
GET_PROC(Flush);
GET_PROC(FrontFace);
GET_PROC(GenBuffers);
GET_PROC(GenerateMipmap);
GET_PROC(GenTextures);
GET_PROC_SUFFIX(GenVertexArrays, OES);
GET_PROC(GetBufferParameteriv);
GET_PROC(GetError);
GET_PROC(GetIntegerv);
GET_PROC(GetProgramInfoLog);
GET_PROC(GetProgramiv);
GET_PROC(GetShaderInfoLog);
GET_PROC(GetShaderiv);
GET_PROC(GetString);
GET_PROC(GetStringi);
GET_PROC(GetUniformLocation);
GET_PROC(LineWidth);
GET_PROC(LinkProgram);
GET_PROC(PixelStorei);
GET_PROC(ReadPixels);
GET_PROC(Scissor);
GET_PROC(ShaderSource);
GET_PROC(StencilFunc);
GET_PROC(StencilFuncSeparate);
GET_PROC(StencilMask);
GET_PROC(StencilMaskSeparate);
GET_PROC(StencilOp);
GET_PROC(StencilOpSeparate);
GET_PROC(TexImage2D);
GET_PROC(TexParameteri);
GET_PROC(TexParameteriv);
GET_PROC(TexSubImage2D);
if (version >= GR_GL_VER(3,0)) {
GET_PROC(TexStorage2D);
} else {
GET_PROC_SUFFIX(TexStorage2D, EXT);
}
GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
GET_PROC(Uniform1f);
GET_PROC(Uniform1i);
GET_PROC(Uniform1fv);
//.........这里部分代码省略.........
示例15: SkNEW
SkPicture* SkPicture::clone() const {
SkPicture* clonedPicture = SkNEW(SkPicture);
clone(clonedPicture, 1);
return clonedPicture;
}