Replace new with SkNEW in more effects classes.
http://codereview.appspot.com/6431052/ git-svn-id: http://skia.googlecode.com/svn/trunk@4727 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e21cb18c52
commit
060ef18d5c
@ -108,7 +108,7 @@ void SkBitmapCache::add(const void* buffer, size_t len, const SkBitmap& bm) {
|
|||||||
fEntryCount -= 1;
|
fEntryCount -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* entry = new Entry(buffer, len, bm);
|
Entry* entry = SkNEW_ARGS(Entry, (buffer, len, bm));
|
||||||
this->attachToHead(entry);
|
this->attachToHead(entry);
|
||||||
fEntryCount += 1;
|
fEntryCount += 1;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +728,7 @@ void Gradient_Shader::commonAsABitmap(SkBitmap* bitmap) const {
|
|||||||
SkAutoMutexAcquire ama(gMutex);
|
SkAutoMutexAcquire ama(gMutex);
|
||||||
|
|
||||||
if (NULL == gCache) {
|
if (NULL == gCache) {
|
||||||
gCache = new SkBitmapCache(MAX_NUM_CACHED_GRADIENT_BITMAPS);
|
gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));
|
||||||
}
|
}
|
||||||
size_t size = count * sizeof(int32_t);
|
size_t size = count * sizeof(int32_t);
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ void SkLayerRasterizer::addLayer(const SkPaint& paint, SkScalar dx,
|
|||||||
SkScalar dy) {
|
SkScalar dy) {
|
||||||
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers.push_back();
|
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers.push_back();
|
||||||
|
|
||||||
new (&rec->fPaint) SkPaint(paint);
|
SkNEW_PLACEMENT_ARGS(&rec->fPaint, SkPaint, (paint));
|
||||||
rec->fOffset.set(dx, dy);
|
rec->fOffset.set(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ SkLayerRasterizer::SkLayerRasterizer(SkFlattenableReadBuffer& buffer)
|
|||||||
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers.push_back();
|
SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)fLayers.push_back();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
new (&rec->fPaint) SkPaint(buffer);
|
SkNEW_PLACEMENT_ARGS(&rec->fPaint, SkPaint, (buffer));
|
||||||
#else
|
#else
|
||||||
new (&rec->fPaint) SkPaint;
|
SkNEW_PLACEMENT(&rec->fPaint, SkPaint);
|
||||||
paint_read(&rec->fPaint, buffer);
|
paint_read(&rec->fPaint, buffer);
|
||||||
#endif
|
#endif
|
||||||
rec->fOffset.fX = buffer.readScalar();
|
rec->fOffset.fX = buffer.readScalar();
|
||||||
|
@ -179,7 +179,7 @@ SkTable_ColorFilter::SkTable_ColorFilter(SkFlattenableReadBuffer& buffer) : INHE
|
|||||||
bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) {
|
bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) {
|
||||||
if (table) {
|
if (table) {
|
||||||
if (NULL == fBitmap) {
|
if (NULL == fBitmap) {
|
||||||
fBitmap = new SkBitmap;
|
fBitmap = SkNEW(SkBitmap);
|
||||||
fBitmap->setConfig(SkBitmap::kA8_Config, 256, 4, 256);
|
fBitmap->setConfig(SkBitmap::kA8_Config, 256, 4, 256);
|
||||||
fBitmap->allocPixels();
|
fBitmap->allocPixels();
|
||||||
uint8_t* bitmapPixels = fBitmap->getAddr8(0, 0);
|
uint8_t* bitmapPixels = fBitmap->getAddr8(0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user