aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-25 20:54:56 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-25 20:54:56 +0000
commit72e7808d62c02f0371135b1c152bd00b73f62479 (patch)
treef5b334c1fa6ce8662458a59fc3f9039a73986e72 /include
parentaae7c2a5b7a11616879e6179357cf38f5bff53ae (diff)
Revert "remove kA1_Config, as it is no longer supported"
This reverts commit 2d72d8b242eac6e9d30228f5b0a407236491c369. git-svn-id: http://skia.googlecode.com/svn/trunk@12387 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBitmap.h22
-rw-r--r--include/core/SkImageDecoder.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index cd85b6a9b1..b58925c9db 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -42,6 +42,12 @@ public:
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 @@ public:
*/
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 @@ inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
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/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h
index 5745dbd5ba..a7e3646553 100644
--- a/include/core/SkImageDecoder.h
+++ b/include/core/SkImageDecoder.h
@@ -186,7 +186,7 @@ public:
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