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

Unified Diff: src/core/SkBlitter_RGB16.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/SkBlitter_RGB16.cpp
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp
index 256cbc6936f6daad6a1c48c798936a3b184dbfc0..b01800b51f52aec576a5fc61fa5dbb292d1f3ebb 100644
--- a/src/core/SkBlitter_RGB16.cpp
+++ b/src/core/SkBlitter_RGB16.cpp
@@ -12,7 +12,6 @@
#include "SkColorPriv.h"
#include "SkDither.h"
#include "SkShader.h"
-#include "SkTemplatesPriv.h"
#include "SkUtils.h"
#include "SkXfermode.h"
@@ -1013,7 +1012,9 @@ void SkRGB16_Shader_Xfermode_Blitter::blitAntiH(int x, int y,
///////////////////////////////////////////////////////////////////////////////
SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
- void* storage, size_t storageSize) {
+ SkTBlitterAllocator* allocator) {
+ SkASSERT(allocator != NULL);
+
SkBlitter* blitter;
SkShader* shader = paint.getShader();
SkXfermode* mode = paint.getXfermode();
@@ -1023,31 +1024,25 @@ SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint,
if (shader) {
if (mode) {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Xfermode_Blitter,
- storage, storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Shader_Xfermode_Blitter>(device, paint);
} else if (shader->canCallShadeSpan16()) {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader16_Blitter,
- storage, storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Shader16_Blitter>(device, paint);
} else {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Shader_Blitter,
- storage, storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Shader_Blitter>(device, paint);
}
} else {
// no shader, no xfermode, (and we always ignore colorfilter)
SkColor color = paint.getColor();
if (0 == SkColorGetA(color)) {
- SK_PLACEMENT_NEW(blitter, SkNullBlitter, storage, storageSize);
+ blitter = allocator->createT<SkNullBlitter>();
#ifdef USE_BLACK_BLITTER
} else if (SK_ColorBLACK == color) {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Black_Blitter, storage,
- storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Black_Blitter>(device, paint);
#endif
} else if (0xFF == SkColorGetA(color)) {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Opaque_Blitter, storage,
- storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint);
} else {
- SK_PLACEMENT_NEW_ARGS(blitter, SkRGB16_Blitter, storage,
- storageSize, (device, paint));
+ blitter = allocator->createT<SkRGB16_Blitter>(device, paint);
}
}

Powered by Google App Engine
This is Rietveld 408576698