aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-18 13:56:50 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-10-18 13:56:50 +0000
commitedb606cb999887d54629f361bcbf57c5fede1bb0 (patch)
tree60ec20fa1b2814dc1d292b6de9f1f299399e1de5 /src/opts
parent095186a466f92b871c8ef8385246405426a67adb (diff)
move LCD blits into opts, so they can have assembly versions
git-svn-id: http://skia.googlecode.com/svn/trunk@2484 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkBlitRow_opts_SSE2.cpp8
-rw-r--r--src/opts/SkBlitRow_opts_SSE2.h7
-rw-r--r--src/opts/SkBlitRow_opts_arm.cpp1
-rw-r--r--src/opts/SkBlitRow_opts_none.cpp1
-rw-r--r--src/opts/opts_check_SSE2.cpp24
5 files changed, 26 insertions, 15 deletions
diff --git a/src/opts/SkBlitRow_opts_SSE2.cpp b/src/opts/SkBlitRow_opts_SSE2.cpp
index 3ea1a9bfae..103e7ed381 100644
--- a/src/opts/SkBlitRow_opts_SSE2.cpp
+++ b/src/opts/SkBlitRow_opts_SSE2.cpp
@@ -383,15 +383,15 @@ void Color32_SSE2(SkPMColor dst[], const SkPMColor src[], int count,
}
}
-void SkARGB32_BlitMask_SSE2(void* device, size_t dstRB,
- SkBitmap::Config dstConfig, const uint8_t* mask,
- size_t maskRB, SkColor origColor,
- int width, int height)
+void SkARGB32_A8_BlitMask_SSE2(void* device, size_t dstRB, const void* maskPtr,
+ size_t maskRB, SkColor origColor,
+ int width, int height)
{
SkPMColor color = SkPreMultiplyColor(origColor);
size_t dstOffset = dstRB - (width << 2);
size_t maskOffset = maskRB - width;
SkPMColor* dst = (SkPMColor *)device;
+ const uint8_t* mask = (const uint8_t*)maskPtr;
do {
int count = width;
if (count >= 4) {
diff --git a/src/opts/SkBlitRow_opts_SSE2.h b/src/opts/SkBlitRow_opts_SSE2.h
index f4c61c17ac..8493e7a291 100644
--- a/src/opts/SkBlitRow_opts_SSE2.h
+++ b/src/opts/SkBlitRow_opts_SSE2.h
@@ -20,7 +20,6 @@ void S32A_Opaque_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst,
void S32A_Blend_BlitRow32_SSE2(SkPMColor* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src,
int count, U8CPU alpha);
-void SkARGB32_BlitMask_SSE2(void* device, size_t dstRB,
- SkBitmap::Config dstConfig, const uint8_t* mask,
- size_t maskRB, SkColor color,
- int width, int height);
+void SkARGB32_A8_BlitMask_SSE2(void* device, size_t dstRB, const void* mask,
+ size_t maskRB, SkColor color,
+ int width, int height);
diff --git a/src/opts/SkBlitRow_opts_arm.cpp b/src/opts/SkBlitRow_opts_arm.cpp
index 393af3c175..d6539634c9 100644
--- a/src/opts/SkBlitRow_opts_arm.cpp
+++ b/src/opts/SkBlitRow_opts_arm.cpp
@@ -1311,6 +1311,7 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() {
SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
+ SkMask::Format maskFormat,
SkColor color)
{
return NULL;
diff --git a/src/opts/SkBlitRow_opts_none.cpp b/src/opts/SkBlitRow_opts_none.cpp
index bb35586fcd..c42ba9f251 100644
--- a/src/opts/SkBlitRow_opts_none.cpp
+++ b/src/opts/SkBlitRow_opts_none.cpp
@@ -28,6 +28,7 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() {
SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
+ SkMask::Format maskFormat,
SkColor color)
{
return NULL;
diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp
index 938e3cb17d..5a7fa3ea4e 100644
--- a/src/opts/opts_check_SSE2.cpp
+++ b/src/opts/opts_check_SSE2.cpp
@@ -55,8 +55,13 @@ static inline bool hasSSE2() {
}
#endif
+static bool cachedHasSSE2() {
+ static bool gHasSSE2 = hasSSE2();
+ return gHasSSE2;
+}
+
void SkBitmapProcState::platformProcs() {
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
if (fSampleProc32 == S32_opaque_D32_filter_DX) {
fSampleProc32 = S32_opaque_D32_filter_DX_SSE2;
} else if (fSampleProc32 == S32_alpha_D32_filter_DX) {
@@ -81,7 +86,7 @@ SkBlitRow::Proc SkBlitRow::PlatformProcs565(unsigned flags) {
}
SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() {
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
return Color32_SSE2;
} else {
return NULL;
@@ -89,7 +94,7 @@ SkBlitRow::ColorProc SkBlitRow::PlatformColorProc() {
}
SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
return platform_32_procs[flags];
} else {
return NULL;
@@ -98,15 +103,20 @@ SkBlitRow::Proc32 SkBlitRow::PlatformProcs32(unsigned flags) {
SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
+ SkMask::Format maskFormat,
SkColor color) {
+ if (SkMask::kA8_Format != maskFormat) {
+ return NULL;
+ }
+
SkBlitMask::Proc proc = NULL;
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
switch (dstConfig) {
case SkBitmap::kARGB_8888_Config:
// The SSE2 version is not (yet) faster for black, so we check
// for that.
if (SK_ColorBLACK != color) {
- proc = SkARGB32_BlitMask_SSE2;
+ proc = SkARGB32_A8_BlitMask_SSE2;
}
break;
default:
@@ -117,7 +127,7 @@ SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
}
SkMemset16Proc SkMemset16GetPlatformProc() {
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
return sk_memset16_SSE2;
} else {
return NULL;
@@ -125,7 +135,7 @@ SkMemset16Proc SkMemset16GetPlatformProc() {
}
SkMemset32Proc SkMemset32GetPlatformProc() {
- if (hasSSE2()) {
+ if (cachedHasSSE2()) {
return sk_memset32_SSE2;
} else {
return NULL;