From 76f9e938df0b5826fd4c80b854ceafaf385cfbe1 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Tue, 15 Jan 2013 20:17:47 +0000 Subject: Added print out of SkShader information to debugger https://codereview.appspot.com/7105045/ git-svn-id: http://skia.googlecode.com/svn/trunk@7201 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkBitmap.h | 3 +++ include/core/SkColorShader.h | 1 + include/core/SkComposeShader.h | 1 + include/core/SkEmptyShader.h | 1 + include/core/SkMatrix.h | 4 ++-- include/core/SkShader.h | 2 ++ include/core/SkTypes.h | 10 ++++++++++ include/effects/SkTransparentShader.h | 1 + include/utils/SkDumpCanvas.h | 4 ++++ 9 files changed, 25 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 7ea950bea2..4ec3ea41cb 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -21,6 +21,7 @@ struct SkRect; class SkPaint; class SkPixelRef; class SkRegion; +class SkString; // This is an opaque class, not interpreted by skia class SkGpuTexture; @@ -625,6 +626,8 @@ public: int fHeight; }; + SkDEVCODE(void toString(SkString* str) const;) + private: struct MipMap; mutable MipMap* fMipMap; diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h index 0823b70b69..c3790682e4 100644 --- a/include/core/SkColorShader.h +++ b/include/core/SkColorShader.h @@ -48,6 +48,7 @@ public: virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; + SK_DEVELOPER_TO_STRING() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) protected: diff --git a/include/core/SkComposeShader.h b/include/core/SkComposeShader.h index b0790bf393..524161b785 100644 --- a/include/core/SkComposeShader.h +++ b/include/core/SkComposeShader.h @@ -39,6 +39,7 @@ public: virtual void endContext() SK_OVERRIDE; virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; + SK_DEVELOPER_TO_STRING() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) protected: diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h index 13da457ad4..08c131db1b 100644 --- a/include/core/SkEmptyShader.h +++ b/include/core/SkEmptyShader.h @@ -30,6 +30,7 @@ public: virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE; + SK_DEVELOPER_TO_STRING() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) protected: diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index 2d3786cf31..f9b72d7aeb 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -527,8 +527,8 @@ public: // return the number of bytes read uint32_t readFromMemory(const void* buffer); - void dump() const; - void toDumpString(SkString*) const; + SkDEVCODE(void dump() const;) + SkDEVCODE(void toString(SkString*) const;) /** * Calculates the maximum stretching factor of the matrix. If the matrix has diff --git a/include/core/SkShader.h b/include/core/SkShader.h index d5945afdd7..899e3b6122 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -341,6 +341,8 @@ public: static SkShader* CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy); + SkDEVCODE(virtual void toString(SkString* str) const;) + protected: enum MatrixClass { kLinear_MatrixClass, // no perspective diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index 113fd00e6b..cbba50cc1b 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -112,6 +112,16 @@ inline void operator delete(void* p) { #define SkAssertResult(cond) cond #endif +#ifdef SK_DEVELOPER + #define SkDEVCODE(code) code + // the 'toString' helper functions convert Sk* objects to human-readable + // form in developer mode + #define SK_DEVELOPER_TO_STRING() virtual void toString(SkString* str) const SK_OVERRIDE; +#else + #define SkDEVCODE(code) + #define SK_DEVELOPER_TO_STRING() +#endif + template struct SkCompileAssert { }; diff --git a/include/effects/SkTransparentShader.h b/include/effects/SkTransparentShader.h index 74187f7912..bee9a02d2d 100644 --- a/include/effects/SkTransparentShader.h +++ b/include/effects/SkTransparentShader.h @@ -21,6 +21,7 @@ public: virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; + SK_DEVELOPER_TO_STRING() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader) private: diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index 608ab01334..8d9c67d50d 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -10,6 +10,8 @@ #include "SkCanvas.h" +#ifdef SK_DEVELOPER + /** This class overrides all the draw methods on SkCanvas, and formats them as text, and then sends that to a Dumper helper object. @@ -155,3 +157,5 @@ private: }; #endif + +#endif -- cgit v1.2.3