diff options
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleAll.cpp | 17 | ||||
-rw-r--r-- | samplecode/SampleText.cpp | 64 | ||||
-rw-r--r-- | samplecode/SampleTextEffects.cpp | 17 |
3 files changed, 0 insertions, 98 deletions
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp index 5b12e68a99..b366ee1232 100644 --- a/samplecode/SampleAll.cpp +++ b/samplecode/SampleAll.cpp @@ -283,23 +283,6 @@ static const struct { { 0xFFFFFF, 0x000000 } // identity case }; -static unsigned color_dist16(uint16_t a, uint16_t b) { - unsigned dr = SkAbs32(SkPacked16ToR32(a) - SkPacked16ToR32(b)); - unsigned dg = SkAbs32(SkPacked16ToG32(a) - SkPacked16ToG32(b)); - unsigned db = SkAbs32(SkPacked16ToB32(a) - SkPacked16ToB32(b)); - - return SkMax32(dr, SkMax32(dg, db)); -} - -static unsigned scale_dist(unsigned dist, unsigned scale) { - dist >>= 6; - dist = (dist << 2) | dist; - dist = (dist << 4) | dist; - return dist; - -// return SkAlphaMul(dist, scale); -} - static void apply_shader(SkPaint* paint, int index) { raster_proc proc = gRastProcs[index]; if (proc) { diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index 7ed16dcc46..eced08a239 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -27,12 +27,6 @@ #include "SkStream.h" #include "SkXMLParser.h" -static const int gKernel[3][3] = { -// { -1, -2, -1 }, { -2, 12, -2 }, { -1, -2, -1 } - { 1, 2, 1 }, { 2, 64-12, 2 }, { 1, 2, 1 } -}; -static const int gShift = 6; - class ReduceNoise : public SkKernel33ProcMaskFilter { public: ReduceNoise(int percent256) : SkKernel33ProcMaskFilter(percent256) {} @@ -190,64 +184,6 @@ static const struct { { "Subpixel", SkPaint::kSubpixelText_Flag, true } }; -static int count_char_points(const SkPaint& paint, char c) { - SkPath path; - - paint.getTextPath(&c, 1, 0, 0, &path); - return path.getPoints(NULL, 0); -} - -static int gOld, gNew, gCount; - -static void dump(int c, int oldc, int newc) { - if (oldc != newc) { - gOld += oldc; - gNew += newc; - gCount += 1; - printf("char %c: old = %3d, new = %3d, reduction %g%%\n", c, oldc, newc, 100. * (oldc - newc) / oldc); - } -} - -static void tab(int n) { -// printf("[%d] ", n); return; - SkASSERT(n >= 0); - for (int i = 0; i < n; i++) - printf(" "); -} - -static void draw_rgn(const SkRegion& rgn, SkCanvas* canvas, const SkPaint& paint) { - SkRect r; - SkRegion::Iterator iter(rgn); - - for (; !iter.done(); iter.next()) { - r.set(iter.rect()); - canvas->drawRect(r, paint); - } -} - -static void test_break(SkCanvas* canvas, const char text[], size_t length, - SkScalar x, SkScalar y, const SkPaint& paint, - SkScalar clickX) { - SkPaint linePaint; - - linePaint.setAntiAlias(true); - - SkScalar measured; - - if (paint.breakText(text, length, clickX - x, &measured, - SkPaint::kForward_TextBufferDirection)) { - linePaint.setColor(SK_ColorRED); - canvas->drawLine(x, y, x + measured, y, linePaint); - } - - x += paint.measureText(text, length); - if (paint.breakText(text, length, x - clickX, &measured, - SkPaint::kBackward_TextBufferDirection)) { - linePaint.setColor(SK_ColorBLUE); - canvas->drawLine(x - measured, y, x, y, linePaint); - } -} - static void DrawTheText(SkCanvas* canvas, const char text[], size_t length, SkScalar x, SkScalar y, const SkPaint& paint, SkScalar clickX, SkMaskFilter* mf) { diff --git a/samplecode/SampleTextEffects.cpp b/samplecode/SampleTextEffects.cpp index a37d1039a5..4a1e202877 100644 --- a/samplecode/SampleTextEffects.cpp +++ b/samplecode/SampleTextEffects.cpp @@ -256,23 +256,6 @@ static const struct { #include "SkXfermode.h" -static unsigned color_dist16(uint16_t a, uint16_t b) { - unsigned dr = SkAbs32(SkPacked16ToR32(a) - SkPacked16ToR32(b)); - unsigned dg = SkAbs32(SkPacked16ToG32(a) - SkPacked16ToG32(b)); - unsigned db = SkAbs32(SkPacked16ToB32(a) - SkPacked16ToB32(b)); - - return SkMax32(dr, SkMax32(dg, db)); -} - -static unsigned scale_dist(unsigned dist, unsigned scale) { - dist >>= 6; - dist = (dist << 2) | dist; - dist = (dist << 4) | dist; - return dist; - -// return SkAlphaMul(dist, scale); -} - static void apply_shader(SkPaint* paint, int index) { raster_proc proc = gRastProcs[index]; if (proc) |