rename/refactor in preparation for supporting accelerated blits of shader-output
through a mask.
git-svn-id: http://skia.googlecode.com/svn/trunk@2684 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBlitMask.h b/src/core/SkBlitMask.h
index 95a81ed..66687a9 100644
--- a/src/core/SkBlitMask.h
+++ b/src/core/SkBlitMask.h
@@ -9,6 +9,7 @@
#define SkBlitMask_DEFINED
#include "SkBitmap.h"
+#include "SkColor.h"
#include "SkMask.h"
class SkBlitMask {
@@ -25,21 +26,41 @@
* by color. The number of pixels to blit is specified by width and height,
* but each scanline is offset by dstRB (rowbytes) and srcRB respectively.
*/
- typedef void (*Proc)(void* dst, size_t dstRB,
- const void* mask, size_t maskRB,
- SkColor color, int width, int height);
+ typedef void (*ColorProc)(void* dst, size_t dstRB,
+ const void* mask, size_t maskRB,
+ SkColor color, int width, int height);
/**
- * Public entry-point to return a blitmask function ptr.
+ * Function pointer that blits a row of src colors through a row of a mask
+ * onto a row of dst colors. The RowFactory that returns this function ptr
+ * will have been told the formats for the mask and the dst.
+ */
+ typedef void (*RowProc)(void* dst, const void* mask,
+ const SkPMColor* src, int width);
+
+ /**
+ * Public entry-point to return a blitmask ColorProc.
* May return NULL if config or format are not supported.
*/
- static Proc Factory(SkBitmap::Config dstConfig, SkMask::Format, SkColor);
-
+ static ColorProc ColorFactory(SkBitmap::Config, SkMask::Format, SkColor);
+
/**
- * Return either platform specific optimized blitmask function-ptr,
+ * Public entry-point to return a blitmask RowProc.
+ * May return NULL if config or format are not supported.
+ */
+ static RowProc RowFactory(SkBitmap::Config, SkMask::Format);
+
+ /**
+ * Return either platform specific optimized blitmask ColorProc,
* or NULL if no optimized routine is available.
*/
- static Proc PlatformProcs(SkBitmap::Config dstConfig, SkMask::Format, SkColor);
+ static ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor);
+
+ /**
+ * Return either platform specific optimized blitmask RowProc,
+ * or NULL if no optimized routine is available.
+ */
+ static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format);
};
#endif
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index 2eb5fb7..356f285 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -305,7 +305,7 @@
///////////////////////////////////////////////////////////////////////////////
-static SkBlitMask::Proc D32_A8_Factory(SkColor color) {
+static SkBlitMask::ColorProc D32_A8_Factory(SkColor color) {
if (SK_ColorBLACK == color) {
return D32_A8_Black;
} else if (0xFF == SkColorGetA(color)) {
@@ -315,13 +315,14 @@
}
}
-static SkBlitMask::Proc D32_LCD32_Factory(SkColor color) {
+static SkBlitMask::ColorProc D32_LCD32_Factory(SkColor color) {
return (0xFF == SkColorGetA(color)) ? D32_LCD32_Opaque : D32_LCD32_Blend;
}
-SkBlitMask::Proc SkBlitMask::Factory(SkBitmap::Config config,
- SkMask::Format format, SkColor color) {
- SkBlitMask::Proc proc = PlatformProcs(config, format, color);
+SkBlitMask::ColorProc SkBlitMask::ColorFactory(SkBitmap::Config config,
+ SkMask::Format format,
+ SkColor color) {
+ ColorProc proc = PlatformColorProcs(config, format, color);
if (proc) {
return proc;
}
@@ -347,7 +348,7 @@
bool SkBlitMask::BlitColor(const SkBitmap& device, const SkMask& mask,
const SkIRect& clip, SkColor color) {
- Proc proc = Factory(device.config(), mask.fFormat, color);
+ ColorProc proc = ColorFactory(device.config(), mask.fFormat, color);
if (proc) {
int x = clip.fLeft;
int y = clip.fTop;
diff --git a/src/opts/opts_check_SSE2.cpp b/src/opts/opts_check_SSE2.cpp
index 5a7fa3e..9ad94ff 100644
--- a/src/opts/opts_check_SSE2.cpp
+++ b/src/opts/opts_check_SSE2.cpp
@@ -102,14 +102,14 @@
}
-SkBlitMask::Proc SkBlitMask::PlatformProcs(SkBitmap::Config dstConfig,
- SkMask::Format maskFormat,
- SkColor color) {
+SkBlitMask::ColorProc SkBlitMask::PlatformColorProcs(SkBitmap::Config dstConfig,
+ SkMask::Format maskFormat,
+ SkColor color) {
if (SkMask::kA8_Format != maskFormat) {
return NULL;
}
-
- SkBlitMask::Proc proc = NULL;
+
+ ColorProc proc = NULL;
if (cachedHasSSE2()) {
switch (dstConfig) {
case SkBitmap::kARGB_8888_Config:
@@ -120,12 +120,17 @@
}
break;
default:
- break;
+ break;
}
}
return proc;
}
+SkBlitMask::RowProc SkBlitMask::PlatformRowProcs(SkBitmap::Config dstConfig,
+ SkMask::Format maskFormat) {
+ return NULL;
+}
+
SkMemset16Proc SkMemset16GetPlatformProc() {
if (cachedHasSSE2()) {
return sk_memset16_SSE2;