aboutsummaryrefslogtreecommitdiffstats
path: root/include/core/SkMask.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkMask.h')
-rw-r--r--include/core/SkMask.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/core/SkMask.h b/include/core/SkMask.h
index 58a2493..4d48376 100644
--- a/include/core/SkMask.h
+++ b/include/core/SkMask.h
@@ -47,6 +47,7 @@ struct SkMask {
kHorizontalLCD_Format, //!< 4 bytes/pixel: a/r/g/b
kVerticalLCD_Format, //!< 4 bytes/pixel: a/r/g/b
kARGB32_Format, //!< SkPMColor
+ kLCD16_Format //!< 565 alpha for r/g/b
};
enum {
@@ -96,6 +97,19 @@ struct SkMask {
return fImage + x - fBounds.fLeft + (y - fBounds.fTop) * fRowBytes;
}
+ /**
+ * Return the address of the specified 16bit mask. In the debug build,
+ * this asserts that the mask's format is kLCD16_Format, and that (x,y)
+ * are contained in the mask's fBounds.
+ */
+ uint16_t* getAddrLCD16(int x, int y) const {
+ SkASSERT(kLCD16_Format == fFormat);
+ SkASSERT(fBounds.contains(x, y));
+ SkASSERT(fImage != NULL);
+ uint16_t* row = (uint16_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
+ return row + (x - fBounds.fLeft);
+ }
+
/** Return an address into the 32-bit plane of an LCD or VerticalLCD mask
for the given position.
*/
@@ -120,7 +134,7 @@ struct SkMask {
static uint8_t* AllocImage(size_t bytes);
static void FreeImage(void* image);
-
+
enum CreateMode {
kJustComputeBounds_CreateMode, //!< compute bounds and return
kJustRenderImage_CreateMode, //!< render into preallocate mask
@@ -128,7 +142,8 @@ struct SkMask {
};
static bool FormatIsLCD(Format fm) {
- return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm;
+ return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm ||
+ kLCD16_Format == fm;
}
};