aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-11-23 15:15:21 -0500
committerMike Reed <reed@google.com>2009-11-23 15:15:21 -0500
commita8b45f65acb9d306cb57edd886728933f13d4424 (patch)
tree5f6dd1e40968868e56b2458fd574f2bba149f704 /include
parent8e048c19870a898cecdde3b3c0d2d512e6f372c0 (diff)
downloadexternal_skia-a8b45f65acb9d306cb57edd886728933f13d4424.zip
external_skia-a8b45f65acb9d306cb57edd886728933f13d4424.tar.gz
external_skia-a8b45f65acb9d306cb57edd886728933f13d4424.tar.bz2
refresh from skia/trunk, fixing winding bug in lineclipper
also catch overflow in scalercontext
Diffstat (limited to 'include')
-rw-r--r--include/core/SkColorPriv.h4
-rw-r--r--include/core/SkPath.h5
-rw-r--r--include/core/SkRect.h5
-rw-r--r--include/core/SkTypes.h46
-rw-r--r--include/views/SkView.h3
5 files changed, 33 insertions, 30 deletions
diff --git a/include/core/SkColorPriv.h b/include/core/SkColorPriv.h
index 15b4d6a..c50bb20 100644
--- a/include/core/SkColorPriv.h
+++ b/include/core/SkColorPriv.h
@@ -33,13 +33,9 @@
*/
static inline unsigned SkAlpha255To256(U8CPU alpha) {
SkASSERT(SkToU8(alpha) == alpha);
-#ifndef SK_USE_OLD_255_TO_256
// this one assues that blending on top of an opaque dst keeps it that way
// even though it is less accurate than a+(a>>7) for non-opaque dsts
return alpha + 1;
-#else
- return alpha + (alpha >> 7);
-#endif
}
/** Multiplify value by 0..256, and shift the result down 8
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 6d4d670..ecdfd1a 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -547,11 +547,8 @@ public:
Verb autoClose(SkPoint pts[2]);
};
-#ifdef SK_DEBUG
- /** @cond UNIT_TEST */
void dump(bool forceClose, const char title[] = NULL) const;
- /** @endcond */
-#endif
+ void dump() const;
void flatten(SkFlattenableWriteBuffer&) const;
void unflatten(SkFlattenableReadBuffer&);
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index a9f25aa..c9f432a 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -49,6 +49,11 @@ struct SkIRect {
return memcmp(&a, &b, sizeof(a));
}
+ bool is16Bit() const {
+ return SkIsS16(fLeft) && SkIsS16(fTop) &&
+ SkIsS16(fRight) && SkIsS16(fBottom);
+ }
+
/** Set the rectangle to (0,0,0,0)
*/
void setEmpty() { memset(this, 0, sizeof(*this)); }
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 00ecb6f..fa21adc 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -149,6 +149,19 @@ typedef uint8_t SkBool8;
#define SK_MinU32 0
#define SK_NaN32 0x80000000
+/** Returns true if the value can be represented with signed 16bits
+ */
+static inline bool SkIsS16(long x) {
+ return (int16_t)x == x;
+}
+
+/** Returns true if the value can be represented with unsigned 16bits
+ */
+static inline bool SkIsU16(long x) {
+ return (uint16_t)x == x;
+}
+
+//////////////////////////////////////////////////////////////////////////////
#ifndef SK_OFFSETOF
#define SK_OFFSETOF(type, field) ((char*)&(((type*)1)->field) - (char*)1)
#endif
@@ -186,7 +199,6 @@ typedef uint32_t SkMSec;
*/
#define SkMSec_LE(a, b) ((int32_t)(a) - (int32_t)(b) <= 0)
-
/****************************************************************************
The rest of these only build with C++
*/
@@ -194,20 +206,17 @@ typedef uint32_t SkMSec;
/** Faster than SkToBool for integral conditions. Returns 0 or 1
*/
-inline int Sk32ToBool(uint32_t n)
-{
+static inline int Sk32ToBool(uint32_t n) {
return (n | (0-n)) >> 31;
}
-template <typename T> inline void SkTSwap(T& a, T& b)
-{
+template <typename T> inline void SkTSwap(T& a, T& b) {
T c(a);
a = b;
b = c;
}
-inline int32_t SkAbs32(int32_t value)
-{
+static inline int32_t SkAbs32(int32_t value) {
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (value < 0)
value = -value;
@@ -218,27 +227,23 @@ inline int32_t SkAbs32(int32_t value)
#endif
}
-inline int32_t SkMax32(int32_t a, int32_t b)
-{
+static inline int32_t SkMax32(int32_t a, int32_t b) {
if (a < b)
a = b;
return a;
}
-inline int32_t SkMin32(int32_t a, int32_t b)
-{
+static inline int32_t SkMin32(int32_t a, int32_t b) {
if (a > b)
a = b;
return a;
}
-inline int32_t SkSign32(int32_t a)
-{
+static inline int32_t SkSign32(int32_t a) {
return (a >> 31) | ((unsigned) -a >> 31);
}
-inline int32_t SkFastMin32(int32_t value, int32_t max)
-{
+static inline int32_t SkFastMin32(int32_t value, int32_t max) {
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (value > max)
value = max;
@@ -253,8 +258,7 @@ inline int32_t SkFastMin32(int32_t value, int32_t max)
/** Returns signed 32 bit value pinned between min and max, inclusively
*/
-inline int32_t SkPin32(int32_t value, int32_t min, int32_t max)
-{
+static inline int32_t SkPin32(int32_t value, int32_t min, int32_t max) {
#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
if (value < min)
value = min;
@@ -269,14 +273,14 @@ inline int32_t SkPin32(int32_t value, int32_t min, int32_t max)
return value;
}
-inline uint32_t SkSetClearShift(uint32_t bits, bool cond, unsigned shift)
-{
+static inline uint32_t SkSetClearShift(uint32_t bits, bool cond,
+ unsigned shift) {
SkASSERT((int)cond == 0 || (int)cond == 1);
return (bits & ~(1 << shift)) | ((int)cond << shift);
}
-inline uint32_t SkSetClearMask(uint32_t bits, bool cond, uint32_t mask)
-{
+static inline uint32_t SkSetClearMask(uint32_t bits, bool cond,
+ uint32_t mask) {
return cond ? bits | mask : bits & ~mask;
}
diff --git a/include/views/SkView.h b/include/views/SkView.h
index f3b729f..fc36d34 100644
--- a/include/views/SkView.h
+++ b/include/views/SkView.h
@@ -96,7 +96,8 @@ public:
void offset(SkScalar dx, SkScalar dy);
/** Call this to have the view draw into the specified canvas. */
- void draw(SkCanvas* canvas);
+ virtual void draw(SkCanvas* canvas);
+
/** Call this to invalidate part of all of a view, requesting that the view's
draw method be called. The rectangle parameter specifies the part of the view
that should be redrawn. If it is null, it specifies the entire view bounds.