Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: src/core/SkSpriteBlitter_ARGB32.cpp

Issue 179343005: Add a class to allocate small objects w/o extra calls to new. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename the .h file Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkSpriteBlitter_ARGB32.cpp
diff --git a/src/core/SkSpriteBlitter_ARGB32.cpp b/src/core/SkSpriteBlitter_ARGB32.cpp
index 3e8612dda3e9e6cdace44dbfb8ff73877efe5e83..b05e5033e44d1334fd710847df3d57357d11bf5e 100644
--- a/src/core/SkSpriteBlitter_ARGB32.cpp
+++ b/src/core/SkSpriteBlitter_ARGB32.cpp
@@ -263,11 +263,10 @@ public:
///////////////////////////////////////////////////////////////////////////////
-#include "SkTemplatesPriv.h"
+SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source, const SkPaint& paint,
+ SkTBlitterAllocator* allocator) {
+ SkASSERT(allocator != NULL);
-SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source,
- const SkPaint& paint,
- void* storage, size_t storageSize) {
if (paint.getMaskFilter() != NULL) {
return NULL;
}
@@ -283,27 +282,22 @@ SkSpriteBlitter* SkSpriteBlitter::ChooseD32(const SkBitmap& source,
return NULL; // we only have opaque sprites
}
if (xfermode || filter) {
- SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_XferFilter,
- storage, storageSize, (source, paint));
+ blitter = allocator->createT<Sprite_D32_S4444_XferFilter>(source, paint);
} else if (source.isOpaque()) {
- SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444_Opaque,
- storage, storageSize, (source));
+ blitter = allocator->createT<Sprite_D32_S4444_Opaque>(source);
} else {
- SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S4444,
- storage, storageSize, (source));
+ blitter = allocator->createT<Sprite_D32_S4444>(source);
}
break;
case kPMColor_SkColorType:
if (xfermode || filter) {
if (255 == alpha) {
// this can handle xfermode or filter, but not alpha
- SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32A_XferFilter,
- storage, storageSize, (source, paint));
+ blitter = allocator->createT<Sprite_D32_S32A_XferFilter>(source, paint);
}
} else {
// this can handle alpha, but not xfermode or filter
- SK_PLACEMENT_NEW_ARGS(blitter, Sprite_D32_S32,
- storage, storageSize, (source, alpha));
+ blitter = allocator->createT<Sprite_D32_S32>(source, alpha);
}
break;
default:

Powered by Google App Engine
This is Rietveld 408576698