aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-14 21:56:45 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-11-14 21:56:45 +0000
commite901b4ccdbd0b7134b7c9ce75701b22ee7821dec (patch)
tree37d9a009abc640f80bda68d5b010f3ad66eb2cbf /src/core
parentec6d2183bdfa18c9232af7bc10bdf77a2d2d1ed8 (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBlitMask.h37
-rw-r--r--src/core/SkBlitMask_D32.cpp13
2 files changed, 36 insertions, 14 deletions
diff --git a/src/core/SkBlitMask.h b/src/core/SkBlitMask.h
index 95a81ed2a5..66687a9c29 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 @@ public:
* 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);
+
+ /**
+ * 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 ColorProc PlatformColorProcs(SkBitmap::Config, SkMask::Format, SkColor);
+
/**
- * Return either platform specific optimized blitmask function-ptr,
+ * Return either platform specific optimized blitmask RowProc,
* or NULL if no optimized routine is available.
*/
- static Proc PlatformProcs(SkBitmap::Config dstConfig, SkMask::Format, SkColor);
+ static RowProc PlatformRowProcs(SkBitmap::Config, SkMask::Format);
};
#endif
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index 2eb5fb7b0c..356f285fec 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -305,7 +305,7 @@ static void D32_LCD32_Opaque(void* SK_RESTRICT dst, size_t dstRB,
///////////////////////////////////////////////////////////////////////////////
-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_A8_Factory(SkColor color) {
}
}
-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 @@ SkBlitMask::Proc SkBlitMask::Factory(SkBitmap::Config config,
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;