#define SkNEW(type_name) new type_name
#define SkNEW_ARGS(type_name, args) new type_name args
#define SkNEW_ARRAY(type_name, count) new type_name[count]
+ #define SkNEW_PLACEMENT(buf, type_name) new (buf) type_name
+ #define SkNEW_PLACEMENT_ARGS(buf, type_name, args) \
+ new (buf) type_name args
#define SkDELETE(obj) delete obj
#define SkDELETE_ARRAY(array) delete[] array
#endif
SkAutoTUnref<GrContext> grCtx;
switch (type) {
case kNative_GLContextType:
- glCtx.reset(new SkNativeGLContext());
+ glCtx.reset(SkNEW(SkNativeGLContext));
break;
#ifdef SK_ANGLE
case kANGLE_GLContextType:
- glCtx.reset(new SkANGLEGLContext());
+ glCtx.reset(SkNEW(SkANGLEGLContext));
break;
#endif
#ifdef SK_MESA
case kMESA_GLContextType:
- glCtx.reset(new SkMesaGLContext());
+ glCtx.reset(SkNEW(SkMesaGLContext));
break;
#endif
case kNull_GLContextType:
- glCtx.reset(new SkNullGLContext());
+ glCtx.reset(SkNEW(SkNullGLContext));
break;
case kDebug_GLContextType:
- glCtx.reset(new SkDebugGLContext());
+ glCtx.reset(SkNEW(SkDebugGLContext));
break;
}
static const int kBogusSize = 1;
the object. */
virtual GLProgramStage* createGLInstance(
const GrCustomStage& stage) const SK_OVERRIDE {
- return new GLProgramStage(*this, stage);
+ return SkNEW_ARGS(GLProgramStage, (*this, stage));
}
/** This class is a singleton. This function returns the single instance.
static SkAlignedSTStorage<1, GrTProgramStageFactory> gInstanceMem;
static const GrTProgramStageFactory* gInstance;
if (!gInstance) {
- gInstance = new (gInstanceMem.get()) GrTProgramStageFactory();
+ gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
+ GrTProgramStageFactory);
}
return *gInstance;
}
uint16_t* data = (uint16_t*) qIdxBuffer->lock();
bool tempData = NULL == data;
if (tempData) {
- data = new uint16_t[kNumQuadsInIdxBuffer * kIdxsPerQuad];
+ data = SkNEW_ARRAY(uint16_t, kNumQuadsInIdxBuffer * kIdxsPerQuad);
}
for (int i = 0; i < kNumQuadsInIdxBuffer; ++i) {
!push_quad_index_data(qIdxBuf)) {
return NULL;
}
- return new GrAAHairLinePathRenderer(context,
- lIdxBuffer,
- qIdxBuf);
+ return SkNEW_ARGS(GrAAHairLinePathRenderer,
+ (context, lIdxBuffer, qIdxBuf));
}
GrAAHairLinePathRenderer::GrAAHairLinePathRenderer(
if (GrPathRenderer* pr = GrAAHairLinePathRenderer::Create(ctx)) {
chain->addPathRenderer(pr)->unref();
}
- chain->addPathRenderer(new GrAAConvexPathRenderer())->unref();
+ chain->addPathRenderer(SkNEW(GrAAConvexPathRenderer))->unref();
}
}
T& push_back() {
void* item = fAllocator.push_back();
GrAssert(NULL != item);
- new (item) T;
+ SkNEW_PLACEMENT(item, T);
return *(T*)item;
}
T& push_back(const T& t) {
void* item = fAllocator.push_back();
GrAssert(NULL != item);
- new (item) T(t);
+ SkNEW_PLACEMENT_ARGS(item, T, (t));
return *(T*)item;
}
fGpu = gpu;
gpu->ref();
Gr_bzero(fTexture, sizeof(fTexture));
- fPlotMgr = new GrPlotMgr(GR_PLOT_WIDTH, GR_PLOT_HEIGHT);
+ fPlotMgr = SkNEW_ARGS(GrPlotMgr, (GR_PLOT_WIDTH, GR_PLOT_HEIGHT));
}
GrAtlasMgr::~GrAtlasMgr() {
}
}
- GrAtlas* newAtlas = new GrAtlas(this, plot.fX, plot.fY, format);
+ GrAtlas* newAtlas = SkNEW_ARGS(GrAtlas, (this, plot.fX, plot.fY, format));
if (!newAtlas->addSubImage(width, height, image, loc)) {
delete newAtlas;
return NULL;
, fStack(sizeof(GrClipStackFrame)) {
// We need an initial frame to capture the clip state prior to
// any pushes
- new (fStack.push_back()) GrClipStackFrame();
+ SkNEW_PLACEMENT(fStack.push_back(), GrClipStackFrame);
}
~GrClipMaskCache() {
* reduce the mask creation cost?
*/
void push() {
- new (fStack.push_back()) GrClipStackFrame();
+ SkNEW_PLACEMENT(fStack.push_back(), GrClipStackFrame);
}
void pop() {
GrContext* ctx = NULL;
GrGpu* fGpu = GrGpu::Create(engine, context3D);
if (NULL != fGpu) {
- ctx = new GrContext(fGpu);
+ ctx = SkNEW_ARGS(GrContext, (fGpu));
fGpu->unref();
}
return ctx;
namespace {
void* CreateThreadInstanceCount() {
- return new int(0);
+ return SkNEW_ARGS(int, (0));
}
void DeleteThreadInstanceCount(void* v) {
delete reinterpret_cast<int*>(v);
sampleM.setIDiv(texture->width(), texture->height());
drawState->sampler(0)->reset(sampleM);
SkAutoTUnref<GrCustomStage> morph(
- new GrMorphologyEffect(direction, radius, morphType));
+ SkNEW_ARGS(GrMorphologyEffect, (direction, radius, morphType)));
drawState->sampler(0)->setCustomStage(morph);
drawState->setTexture(0, texture);
gpu->drawSimpleRect(rect, NULL, 1 << 0);
GrMatrix sampleM;
sampleM.setIDiv(texture->width(), texture->height());
drawState->sampler(0)->reset(sampleM);
- SkAutoTUnref<GrConvolutionEffect> conv(new
- GrConvolutionEffect(direction, radius));
+ SkAutoTUnref<GrConvolutionEffect> conv(SkNEW_ARGS(GrConvolutionEffect,
+ (direction, radius)));
conv->setGaussianKernel(sigma);
drawState->sampler(0)->setCustomStage(conv);
drawState->setTexture(0, texture);
bool allowSW) {
if (NULL == fPathRendererChain) {
fPathRendererChain =
- new GrPathRendererChain(this, GrPathRendererChain::kNone_UsageFlag);
+ SkNEW_ARGS(GrPathRendererChain,
+ (this, GrPathRendererChain::kNone_UsageFlag));
}
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(path, fill,
if (NULL == pr && allowSW) {
if (NULL == fSoftwarePathRenderer) {
- fSoftwarePathRenderer = new GrSoftwarePathRenderer(this);
+ fSoftwarePathRenderer = SkNEW_ARGS(GrSoftwarePathRenderer, (this));
}
pr = fSoftwarePathRenderer;
fGpu->ref();
fGpu->setContext(this);
- fDrawState = new GrDrawState();
+ fDrawState = SkNEW(GrDrawState);
fGpu->setDrawState(fDrawState);
fPathRendererChain = NULL;
fSoftwarePathRenderer = NULL;
- fTextureCache = new GrResourceCache(MAX_TEXTURE_CACHE_COUNT,
- MAX_TEXTURE_CACHE_BYTES);
- fFontCache = new GrFontCache(fGpu);
+ fTextureCache = SkNEW_ARGS(GrResourceCache,
+ (MAX_TEXTURE_CACHE_COUNT,
+ MAX_TEXTURE_CACHE_BYTES));
+ fFontCache = SkNEW_ARGS(GrFontCache, (fGpu));
fLastDrawCategory = kUnbuffered_DrawCategory;
fDrawBufferVBAllocPool = NULL;
fDrawBufferIBAllocPool = NULL;
- fAARectRenderer = new GrAARectRenderer;
+ fAARectRenderer = SkNEW(GrAARectRenderer);
this->setupDrawBuffer();
}
#if DEFER_TEXT_RENDERING || BATCH_RECT_TO_RECT || DEFER_PATHS
fDrawBufferVBAllocPool =
- new GrVertexBufferAllocPool(fGpu, false,
+ SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, false,
DRAW_BUFFER_VBPOOL_BUFFER_SIZE,
- DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS);
+ DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS));
fDrawBufferIBAllocPool =
- new GrIndexBufferAllocPool(fGpu, false,
+ SkNEW_ARGS(GrIndexBufferAllocPool, (fGpu, false,
DRAW_BUFFER_IBPOOL_BUFFER_SIZE,
- DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS);
+ DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS));
- fDrawBuffer = new GrInOrderDrawBuffer(fGpu,
+ fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (fGpu,
fDrawBufferVBAllocPool,
- fDrawBufferIBAllocPool);
+ fDrawBufferIBAllocPool));
#endif
#if BATCH_RECT_TO_RECT
void GrGpu::prepareVertexPool() {
if (NULL == fVertexPool) {
GrAssert(0 == fVertexPoolUseCnt);
- fVertexPool = new GrVertexBufferAllocPool(this, true,
+ fVertexPool = SkNEW_ARGS(GrVertexBufferAllocPool, (this, true,
VERTEX_POOL_VB_SIZE,
- VERTEX_POOL_VB_COUNT);
+ VERTEX_POOL_VB_COUNT));
fVertexPool->releaseGpuRef();
} else if (!fVertexPoolUseCnt) {
// the client doesn't have valid data in the pool
void GrGpu::prepareIndexPool() {
if (NULL == fIndexPool) {
GrAssert(0 == fIndexPoolUseCnt);
- fIndexPool = new GrIndexBufferAllocPool(this, true,
+ fIndexPool = SkNEW_ARGS(GrIndexBufferAllocPool, (this, true,
INDEX_POOL_IB_SIZE,
- INDEX_POOL_IB_COUNT);
+ INDEX_POOL_IB_COUNT));
fIndexPool->releaseGpuRef();
} else if (!fIndexPoolUseCnt) {
// the client doesn't have valid data in the pool
}
GrGLContextInfo ctxInfo(glInterface);
if (ctxInfo.isInitialized()) {
- return new GrGpuGL(ctxInfo);
+ return SkNEW_ARGS(GrGpuGL, (ctxInfo));
}
}
return NULL;
bool twoSided = gpu->getCaps().fTwoSidedStencilSupport;
bool wrapOp = gpu->getCaps().fStencilWrapOpsSupport;
GrPathRenderer::AddPathRenderers(fOwner, fFlags, this);
- this->addPathRenderer(new GrDefaultPathRenderer(twoSided, wrapOp))->unref();
+ this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
+ (twoSided, wrapOp)))->unref();
fInit = true;
}
if (needed <= sizeof(fStorage)) {
fBusy = fStorage;
} else {
- fBusy = new char[needed];
+ fBusy = SkNEW_ARRAY(char, needed);
}
this->reset();
}
///////////////////////////////////////////////////////////////////////////////
GrRectanizer* GrRectanizer::Factory(int width, int height) {
- return new GrRectanizerPow2(width, height);
+ return SkNEW_ARGS(GrRectanizerPow2, (width, height));
}
///////////////////////////////////////////////////////////////////////////////
GrRectanizer* GrRectanizer::Factory(int width, int height) {
- return new GrRectanizerFIFO(width, height);
+ return SkNEW_ARGS(GrRectanizerFIFO, (width, height));
}
++fCount;
- Node* x = new Node;
+ Node* x = SkNEW(Node);
x->fChildren[kLeft_Child] = NULL;
x->fChildren[kRight_Child] = NULL;
x->fItem = t;
GrAssert(!fPurging);
GrAutoResourceCacheValidate atcv(this);
- GrResourceEntry* entry = new GrResourceEntry(key, resource);
+ GrResourceEntry* entry = SkNEW_ARGS(GrResourceEntry, (key, resource));
if (lock) {
// mark the entry as "busy" so it doesn't get purged
GrAssert(NULL != context);
GrAssert(NULL != context->getGpu());
if (context->getGpu()->getCaps().fPathStencilingSupport) {
- return new GrStencilAndCoverPathRenderer(context->getGpu());
+ return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu()));
} else {
return NULL;
}
}
if (NULL == glyph->fPath) {
- SkPath* path = new SkPath;
+ SkPath* path = SkNEW(SkPath);
if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
// flag the glyph as being dead?
delete path;
GrTextStrike* GrFontCache::generateStrike(GrFontScaler* scaler,
const Key& key) {
if (NULL == fAtlasMgr) {
- fAtlasMgr = new GrAtlasMgr(fGpu);
+ fAtlasMgr = SkNEW_ARGS(GrAtlasMgr, (fGpu));
}
- GrTextStrike* strike = new GrTextStrike(this, scaler->getKey(),
- scaler->getMaskFormat(), fAtlasMgr);
+ GrTextStrike* strike = SkNEW_ARGS(GrTextStrike,
+ (this, scaler->getKey(),
+ scaler->getMaskFormat(), fAtlasMgr));
fCache.insert(key, strike);
if (fHead) {
fContext = context;
fContext->ref();
- this->setDevice(new SkGpuDevice(context, renderTarget))->unref();
+ this->setDevice(SkNEW_ARGS(SkGpuDevice, (context, renderTarget)))->unref();
}
SkGpuCanvas::~SkGpuCanvas() {
// are ensuring that both objects will live as long as the pixel ref.
SkPixelRef* pr;
if (fTexture) {
- pr = new SkGrTexturePixelRef(fTexture);
+ pr = SkNEW_ARGS(SkGrTexturePixelRef, (fTexture));
} else {
- pr = new SkGrRenderTargetPixelRef(fRenderTarget);
+ pr = SkNEW_ARGS(SkGrRenderTargetPixelRef, (fRenderTarget));
}
this->setPixelRef(pr, 0)->unref();
}
GrAssert(NULL != fRenderTarget);
// wrap the bitmap with a pixelref to expose our texture
- SkGrTexturePixelRef* pr = new SkGrTexturePixelRef(fTexture);
+ SkGrTexturePixelRef* pr = SkNEW_ARGS(SkGrTexturePixelRef, (fTexture));
this->setPixelRef(pr, 0)->unref();
} else {
GrPrintf("--- failed to create gpu-offscreen [%d %d]\n",
GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx);
switch (bmptype) {
case SkShader::kRadial_BitmapType:
- sampler->setCustomStage(new GrRadialGradient())->unref();
+ sampler->setCustomStage(SkNEW(GrRadialGradient))->unref();
sampler->setFilter(GrSamplerState::kBilinear_Filter);
break;
case SkShader::kSweep_BitmapType:
- sampler->setCustomStage(new GrSweepGradient())->unref();
+ sampler->setCustomStage(SkNEW(GrSweepGradient))->unref();
sampler->setFilter(GrSamplerState::kBilinear_Filter);
break;
case SkShader::kTwoPointRadial_BitmapType:
- sampler->setCustomStage(new
- GrRadial2Gradient(twoPointParams[0],
- twoPointParams[1],
- twoPointParams[2] < 0))->unref();
+ sampler->setCustomStage(SkNEW_ARGS(GrRadial2Gradient,
+ (twoPointParams[0],
+ twoPointParams[1],
+ twoPointParams[2] < 0)))->unref();
sampler->setFilter(GrSamplerState::kBilinear_Filter);
break;
case SkShader::kTwoPointConical_BitmapType:
- sampler->setCustomStage(new
- GrConical2Gradient(twoPointParams[0],
- twoPointParams[1],
- twoPointParams[2]))->unref();
+ sampler->setCustomStage(SkNEW_ARGS(GrConical2Gradient,
+ (twoPointParams[0],
+ twoPointParams[1],
+ twoPointParams[2])))->unref();
sampler->setFilter(GrSamplerState::kBilinear_Filter);
break;
default:
SkIntToScalar(src.height()));
GrTexture* resultTexture = filter_texture(fContext, texture, filter, rect);
if (resultTexture) {
- result->setPixelRef(new SkGrTexturePixelRef(resultTexture))->unref();
+ result->setPixelRef(SkNEW_ARGS(SkGrTexturePixelRef,
+ (resultTexture)))->unref();
resultTexture->unref();
}
return true;
scaler = (GrFontScaler*)auxData;
}
if (NULL == scaler) {
- scaler = new SkGrFontScaler(cache);
+ scaler = SkNEW_ARGS(SkGrFontScaler, (cache));
cache->setAuxProc(GlyphCacheAuxProc, scaler);
}
return scaler;
// deferred allocation
if (NULL == fDrawProcs) {
- fDrawProcs = new GrSkDrawProcs;
+ fDrawProcs = SkNEW(GrSkDrawProcs);
fDrawProcs->fD1GProc = SkGPU_Draw1Glyph;
fDrawProcs->fContext = fContext;
}
const GrKey* SkGrFontScaler::getKey() {
if (NULL == fKey) {
- fKey = new SkGrDescKey(fStrike->getDescriptor());
+ fKey = SkNEW_ARGS(SkGrDescKey, (fStrike->getDescriptor()));
}
return fKey;
}
dst->releaseRenderTarget();
#endif
- SkGrPixelRef* pixelRef = new SkGrPixelRef(dst);
+ SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (dst));
GrSafeUnref(dst);
return pixelRef;
}
static State* get_state() {
static State* gState;
if (NULL == gState) {
- gState = new State;
+ gState = SkNEW(State);
}
return gState;
}
// interface
static SkAutoTUnref<GrGLInterface> glInterface;
if (!glInterface.get()) {
- GrGLInterface* interface = new GrGLInterface;
+ GrGLInterface* interface = SkNEW(GrGLInterface);
glInterface.reset(interface);
interface->fBindingsExported = kDesktop_GrGLBinding;
interface->fActiveTexture = nullGLActiveTexture;
fTexParams.invalidate();
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
- fTexIDObj = new GrGLTexID(GPUGL->glInterface(),
- textureDesc.fTextureID,
- textureDesc.fOwnsID);
+ fTexIDObj = SkNEW_ARGS(GrGLTexID,
+ (GPUGL->glInterface(),
+ textureDesc.fTextureID,
+ textureDesc.fOwnsID));
fOrientation = textureDesc.fOrientation;
if (NULL != rtDesc) {
vp.fBottom = 0;
vp.fHeight = textureDesc.fHeight;
- fRenderTarget = new GrGLRenderTarget(gpu, *rtDesc, vp, fTexIDObj, this);
+ fRenderTarget = SkNEW_ARGS(GrGLRenderTarget,
+ (gpu, *rtDesc, vp, fTexIDObj, this));
}
}
this->initCaps();
fProgramData = NULL;
- fProgramCache = new ProgramCache(this->glContextInfo());
+ fProgramCache = SkNEW_ARGS(ProgramCache, (this->glContextInfo()));
fLastSuccessfulStencilFmtIdx = 0;
fCanPreserveUnpremulRoundtrip = kUnknown_CanPreserveUnpremulRoundtrip;
&glRTDesc)) {
return NULL;
}
- texture = new GrGLTexture(this, glTexDesc, glRTDesc);
+ texture = SkNEW_ARGS(GrGLTexture, (this, glTexDesc, glRTDesc));
} else {
- texture = new GrGLTexture(this, glTexDesc);
+ texture = SkNEW_ARGS(GrGLTexture, (this, glTexDesc));
}
if (NULL == texture) {
return NULL;
viewport.fWidth = desc.fWidth;
viewport.fHeight = desc.fHeight;
- GrRenderTarget* tgt = new GrGLRenderTarget(this, glDesc, viewport);
+ GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget,
+ (this, glDesc, viewport));
if (desc.fStencilBits) {
GrGLStencilBuffer::Format format;
format.fInternalFormat = GrGLStencilBuffer::kUnknownInternalFormat;
format.fPacked = false;
format.fStencilBits = desc.fStencilBits;
format.fTotalBits = desc.fStencilBits;
- GrGLStencilBuffer* sb = new GrGLStencilBuffer(this,
- 0,
- desc.fWidth,
- desc.fHeight,
- desc.fSampleCnt,
- format);
+ GrGLStencilBuffer* sb = SkNEW_ARGS(GrGLStencilBuffer,
+ (this,
+ 0,
+ desc.fWidth,
+ desc.fHeight,
+ desc.fSampleCnt,
+ format));
tgt->setStencilBuffer(sb);
sb->unref();
}
GL_CALL(DeleteTextures(1, &glTexDesc.fTextureID));
return return_null_texture();
}
- tex = new GrGLTexture(this, glTexDesc, glRTDesc);
+ tex = SkNEW_ARGS(GrGLTexture, (this, glTexDesc, glRTDesc));
} else {
- tex = new GrGLTexture(this, glTexDesc);
+ tex = SkNEW_ARGS(GrGLTexture, (this, glTexDesc));
}
tex->setCachedTexParams(initialTexParams, this->getResetTimestamp());
#ifdef TRACE_TEXTURE_CREATION
// whatever sizes GL gives us. In that case we query for the size.
GrGLStencilBuffer::Format format = sFmt;
get_stencil_rb_sizes(this->glInterface(), sbID, &format);
- sb = new GrGLStencilBuffer(this, sbID, width, height,
- samples, format);
+ sb = SkNEW_ARGS(GrGLStencilBuffer,
+ (this, sbID, width, height,
+ samples, format));
if (this->attachStencilBufferToRenderTarget(sb, rt)) {
fLastSuccessfulStencilFmtIdx = sIdx;
rt->setStencilBuffer(sb);
fHWGeometryState.fVertexBuffer = NULL;
return NULL;
}
- GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, id,
- size, dynamic);
+ GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer,
+ (this, id,
+ size, dynamic));
fHWGeometryState.fVertexBuffer = vertexBuffer;
return vertexBuffer;
}
fHWGeometryState.fIndexBuffer = NULL;
return NULL;
}
- GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, id,
- size, dynamic);
+ GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer,
+ (this, id, size, dynamic));
fHWGeometryState.fIndexBuffer = indexBuffer;
return indexBuffer;
}
GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) {
GrAssert(fCaps.fPathStencilingSupport);
- return new GrGLPath(this, inPath);
+ return SkNEW_ARGS(GrGLPath, (this, inPath));
}
void GrGpuGL::flushScissor() {
// does not work with perspective or mul-by-alpha-mask
stageDesc->fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
stageDesc->fInConfigFlags &= ~kMulByAlphaMask;
- return new GrConvolutionEffect(gKernelDirections[direction],
- kernelRadius,
- kernel);
+ return SkNEW_ARGS(GrConvolutionEffect,
+ (gKernelDirections[direction],
+ kernelRadius,
+ kernel));
}
case kErode_EffectType: {
int direction = random_int(random, 2);
// does not work with perspective or mul-by-alpha-mask
stageDesc->fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
stageDesc->fInConfigFlags &= ~kMulByAlphaMask;
- return new GrMorphologyEffect(gKernelDirections[direction],
- kernelRadius,
- GrContext::kErode_MorphologyType);
+ return SkNEW_ARGS(GrMorphologyEffect,
+ (gKernelDirections[direction],
+ kernelRadius,
+ GrContext::kErode_MorphologyType));
}
case kDilate_EffectType: {
int direction = random_int(random, 2);
// does not work with perspective or mul-by-alpha-mask
stageDesc->fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
stageDesc->fInConfigFlags &= ~kMulByAlphaMask;
- return new GrMorphologyEffect(gKernelDirections[direction],
- kernelRadius,
- GrContext::kDilate_MorphologyType);
+ return SkNEW_ARGS(GrMorphologyEffect,
+ (gKernelDirections[direction],
+ kernelRadius,
+ GrContext::kDilate_MorphologyType));
}
case kRadialGradient_EffectType: {
- return new GrRadialGradient();
+ return SkNEW(GrRadialGradient);
}
case kRadial2Gradient_EffectType: {
float center;
} while (GR_Scalar1 == center);
float radius = random->nextF();
bool root = random_bool(random);
- return new GrRadial2Gradient(center, radius, root);
+ return SkNEW_ARGS(GrRadial2Gradient, (center, radius, root));
}
case kSweepGradient_EffectType: {
- return new GrSweepGradient();
+ return SkNEW(GrSweepGradient);
}
default:
GrCrash("Unexpected custom effect type");
void gr_hello_world() {
static GrGpu* gGpu;
if (NULL == gGpu) {
- gGpu = new SkGpuGLShaders;
+ gGpu = SkNEW(SkGpuGLShaders);
}
SkGLCanvas canvas(gGpu);