Revert "remove kA1_Config, as it is no longer supported"
This reverts commit 2d72d8b242eac6e9d30228f5b0a407236491c369.
git-svn-id: http://skia.googlecode.com/svn/trunk/include@12387 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkBitmap.h b/core/SkBitmap.h
index cd85b6a..b58925c 100644
--- a/core/SkBitmap.h
+++ b/core/SkBitmap.h
@@ -42,6 +42,12 @@
enum Config {
kNo_Config, //!< bitmap has not been configured
+ /**
+ * 1-bit per pixel, (0 is transparent, 1 is opaque)
+ * Valid as a destination (target of a canvas), but not valid as a src.
+ * i.e. you can draw into a 1-bit bitmap, but you cannot draw from one.
+ */
+ kA1_Config,
kA8_Config, //!< 8-bits per pixel, with only alpha specified (0 is transparent, 0xFF is opaque)
kIndex8_Config, //!< 8-bits per pixel, using SkColorTable to specify the colors
kRGB_565_Config, //!< 16-bits per pixel, (see SkColorPriv.h for packing)
@@ -483,6 +489,14 @@
*/
inline uint8_t* getAddr8(int x, int y) const;
+ /** Returns the address of the byte containing the pixel specified by x,y
+ * for 1bit pixels.
+ * In debug build, this asserts that the pixels are allocated and locked,
+ * and that the config is 1-bit, however none of these checks are performed
+ * in the release build.
+ */
+ inline uint8_t* getAddr1(int x, int y) const;
+
/** Returns the color corresponding to the pixel specified by x,y for
* colortable based bitmaps.
* In debug build, this asserts that the pixels are allocated and locked,
@@ -804,4 +818,12 @@
return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
}
+// returns the address of the byte that contains the x coordinate
+inline uint8_t* SkBitmap::getAddr1(int x, int y) const {
+ SkASSERT(fPixels);
+ SkASSERT(fConfig == kA1_Config);
+ SkASSERT((unsigned)x < fWidth && (unsigned)y < fHeight);
+ return (uint8_t*)fPixels + y * fRowBytes + (x >> 3);
+}
+
#endif
diff --git a/core/SkImageDecoder.h b/core/SkImageDecoder.h
index 5745dbd..a7e3646 100644
--- a/core/SkImageDecoder.h
+++ b/core/SkImageDecoder.h
@@ -186,7 +186,7 @@
src: 32/24, no-alpha -> 4
src: 32/24, yes-alpha -> 5
*/
- void setPrefConfigTable(const SkBitmap::Config pref[5]);
+ void setPrefConfigTable(const SkBitmap::Config pref[6]);
/**
* Optional table describing the caller's preferred config based on