From e6ea606fb92cd611b965806cb005f87495b261f2 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Thu, 7 Jul 2011 19:12:50 +0000 Subject: [PATCH] re-enable SSE2 blitmask procs, only excluding if we're black (in which case the protable version is still faster) git-svn-id: http://skia.googlecode.com/svn/trunk@1819 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkBlitRow_D32.cpp | 1 - src/core/SkBlitter_ARGB32.cpp | 25 +++++-------------------- src/opts/opts_check_SSE2.cpp | 11 +++++------ 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/core/SkBlitRow_D32.cpp b/src/core/SkBlitRow_D32.cpp index 642fe7f8e..72df59c75 100644 --- a/src/core/SkBlitRow_D32.cpp +++ b/src/core/SkBlitRow_D32.cpp @@ -230,7 +230,6 @@ static void D32_Mask_Black(void* dst, size_t dstRB, SkBitmap::Config, SkBlitMask::Proc SkBlitMask::Factory(SkBitmap::Config config, SkColor color) { SkBlitMask::Proc proc = PlatformProcs(config, color); - proc = NULL; if (NULL == proc) { switch (config) { case SkBitmap::kARGB_8888_Config: diff --git a/src/core/SkBlitter_ARGB32.cpp b/src/core/SkBlitter_ARGB32.cpp index f54bd5a27..073757ac0 100644 --- a/src/core/SkBlitter_ARGB32.cpp +++ b/src/core/SkBlitter_ARGB32.cpp @@ -409,26 +409,11 @@ void SkARGB32_Black_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) { } else if (SkMask::kLCD32_Format == mask.fFormat) { blitmask_lcd32(fDevice, mask, clip, fPMColor); } else { - unsigned width = clip.width(); - unsigned height = clip.height(); - - SkASSERT((int)height > 0); - SkASSERT((int)width > 0); - - uint32_t* device = fDevice.getAddr32(clip.fLeft, clip.fTop); - unsigned maskRB = mask.fRowBytes - width; - unsigned deviceRB = fDevice.rowBytes() - (width << 2); - const uint8_t* alpha = mask.getAddr(clip.fLeft, clip.fTop); - do { - unsigned w = width; - do { - unsigned aa = *alpha++; - *device = (aa << SK_A32_SHIFT) + SkAlphaMulQ(*device, SkAlpha255To256(255 - aa)); - device += 1; - } while (--w != 0); - device = (uint32_t*)((char*)device + deviceRB); - alpha += maskRB; - } while (--height != 0); + fBlitMaskProc(fDevice.getAddr32(clip.fLeft, clip.fTop), + fDevice.rowBytes(), + SkBitmap::kARGB_8888_Config, + mask.getAddr(clip.fLeft, clip.fTop), mask.fRowBytes, + 0xFF000000, clip.width(), clip.height()); } } diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp index 749117a1a..09d99e9e7 100644 --- a/src/opts/opts_check_SSE2.cpp +++ b/src/opts/opts_check_SSE2.cpp @@ -107,17 +107,16 @@ SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) { SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig, - SkColor color) -{ - + SkColor color) { SkBlitMask::Proc proc = NULL; if (hasSSE2()) { switch (dstConfig) { case SkBitmap::kARGB_8888_Config: - // TODO: is our current SSE2 faster than the portable, even in - // the case of black or opaque? If so, no need for this check. - if ( SK_ColorBLACK != color && 0xFF != SkColorGetA(color)) + // The SSE2 version is not (yet) faster for black, so we check + // for that. + if (SK_ColorBLACK != color) { proc = SkARGB32_BlitMask_SSE2; + } break; default: break;