summaryrefslogtreecommitdiffstats
path: root/skia/include
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-12 20:08:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-12 20:08:50 +0000
commit2786f3db2489aa1fd2453fa85745e5c5658b1cd1 (patch)
tree905f82e544746d33d6cc4a3f760a345f648a4fd1 /skia/include
parentb734450b86e9d6bd7a07b381c119ca91803ae46b (diff)
downloadchromium_src-2786f3db2489aa1fd2453fa85745e5c5658b1cd1.zip
chromium_src-2786f3db2489aa1fd2453fa85745e5c5658b1cd1.tar.gz
chromium_src-2786f3db2489aa1fd2453fa85745e5c5658b1cd1.tar.bz2
Hook up skia's assertions to our logging system.
Review URL: http://codereview.chromium.org/17285 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/include')
-rw-r--r--skia/include/SkColorPriv.h2
-rw-r--r--skia/include/corecg/SkPostConfig.h8
-rw-r--r--skia/include/corecg/SkUserConfig.h28
3 files changed, 26 insertions, 12 deletions
diff --git a/skia/include/SkColorPriv.h b/skia/include/SkColorPriv.h
index 09ddb63..a041547 100644
--- a/skia/include/SkColorPriv.h
+++ b/skia/include/SkColorPriv.h
@@ -142,7 +142,7 @@ inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[],
}
#ifdef SK_DEBUG
- U16CPU SkRGB16Add(U16CPU a, U16CPU b) {
+ static inline U16CPU SkRGB16Add(U16CPU a, U16CPU b) {
SkASSERT(SkGetPackedR16(a) + SkGetPackedR16(b) <= SK_R16_MASK);
SkASSERT(SkGetPackedG16(a) + SkGetPackedG16(b) <= SK_G16_MASK);
SkASSERT(SkGetPackedB16(a) + SkGetPackedB16(b) <= SK_B16_MASK);
diff --git a/skia/include/corecg/SkPostConfig.h b/skia/include/corecg/SkPostConfig.h
index b2190ba..9fb27c4 100644
--- a/skia/include/corecg/SkPostConfig.h
+++ b/skia/include/corecg/SkPostConfig.h
@@ -96,12 +96,16 @@
// Chrome already defines WIN32_LEAN_AND_MEAN so no need to define it here.
#include <windows.h>
- // End Chrome-specific changes
+ #include <stdio.h>
#ifndef SK_DEBUGBREAK
- #define SK_DEBUGBREAK(cond) do { if (!(cond)) DebugBreak(); } while (false)
+ #define SK_DEBUGBREAK(cond) do { if (!(cond)) { \
+ SkDebugf("%s:%d: failed assertion \"%s\"\n", \
+ __FILE__, __LINE__, #cond); SK_CRASH(); } } while (false)
#endif
+ // End Chrome-specific changes
+
#ifdef SK_BUILD_FOR_WIN32
#define strcasecmp(a, b) stricmp(a, b)
#define strncasecmp(a, b, c) strnicmp(a, b, c)
diff --git a/skia/include/corecg/SkUserConfig.h b/skia/include/corecg/SkUserConfig.h
index 2a646ce..28a1893 100644
--- a/skia/include/corecg/SkUserConfig.h
+++ b/skia/include/corecg/SkUserConfig.h
@@ -86,6 +86,14 @@
#define SK_SCALAR_IS_FLOAT
#undef SK_SCALAR_IS_FIXED
+// Log the file and line number for assertions.
+#define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, __VA_ARGS__)
+void SkDebugf_FileLine(const char* file, int line, const char* format, ...);
+#include <stdio.h>
+#define SK_DEBUGBREAK(cond) do { if (!(cond)) { \
+ SkDebugf("%s:%d: failed assertion \"%s\"\n", \
+ __FILE__, __LINE__, #cond); SK_CRASH(); } } while (false)
+
#if defined(SK_BUILD_FOR_WIN32)
#define SK_BUILD_FOR_WIN
@@ -103,6 +111,10 @@ typedef unsigned uint32_t;
#define SK_G32_SHIFT 8
#define SK_B32_SHIFT 0
+// VC doesn't support __restrict__, so make it a NOP.
+#undef SK_RESTRICT
+#define SK_RESTRICT
+
// Skia uses this deprecated bzero function to fill zeros into a string.
#define bzero(str, len) memset(str, 0, len)
@@ -138,16 +150,14 @@ typedef unsigned uint32_t;
#endif
-// Don't use skia debug mode even when compiled as debug, because we don't
-// care about debugging this library, only our app.
-#undef SK_DEBUG
-#undef SK_SUPPORT_UNITTEST
-#define SK_RELEASE
-#undef SK_RESTRICT
-#define SK_RESTRICT
-#define SkDebugf(...) ((void)0)
+#ifndef NDEBUG
+ #define SK_DEBUG
+ #undef SK_RELEASE
+#else
+ #define SK_RELEASE
+ #undef SK_DEBUG
+#endif
// ===== End Chrome-specific definitions =====
#endif
-