LCOV - code coverage report
Current view: directory - gfx/skia/include/core - SkAutoKern.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 0 0.0 %
Date: 2012-06-02 Functions: 2 0 0.0 %

       1                 : 
       2                 : /*
       3                 :  * Copyright 2006 The Android Open Source Project
       4                 :  *
       5                 :  * Use of this source code is governed by a BSD-style license that can be
       6                 :  * found in the LICENSE file.
       7                 :  */
       8                 : 
       9                 : 
      10                 : #ifndef SkAutoKern_DEFINED
      11                 : #define SkAutoKern_DEFINED
      12                 : 
      13                 : #include "SkScalerContext.h"
      14                 : 
      15                 : #define SkAutoKern_AdjustF(prev, next)    (((next) - (prev) + 32) >> 6 << 16)
      16                 : #define SkAutoKern_AdjustS(prev, next)    SkIntToScalar(((next) - (prev) + 32) >> 6)
      17                 : 
      18                 : /* this is a helper class to perform auto-kerning
      19                 :  * the adjust() method returns a SkFixed corresponding
      20                 :  * to a +1/0/-1 pixel adjustment
      21                 :  */
      22                 : 
      23                 : class SkAutoKern {
      24                 : public:
      25               0 :     SkAutoKern() : fPrevRsbDelta(0) {}
      26                 : 
      27               0 :     SkFixed  adjust(const SkGlyph&  glyph) 
      28                 :     {
      29                 : //        if (SkAbs32(glyph.fLsbDelta) > 47 || SkAbs32(glyph.fRsbDelta) > 47)
      30                 : //            printf("------- %d> L %d R %d\n", glyph.f_GlyphID, glyph.fLsbDelta, glyph.fRsbDelta);
      31                 : 
      32                 : #if 0
      33                 :         int  distort = fPrevRsbDelta - glyph.fLsbDelta;
      34                 : 
      35                 :         fPrevRsbDelta = glyph.fRsbDelta;
      36                 : 
      37                 :         if (distort >= 32)
      38                 :             return -SK_Fixed1;
      39                 :         else if (distort < -32)
      40                 :             return +SK_Fixed1;
      41                 :         else
      42                 :             return 0;
      43                 : #else
      44               0 :         SkFixed adjust = SkAutoKern_AdjustF(fPrevRsbDelta, glyph.fLsbDelta);
      45               0 :         fPrevRsbDelta = glyph.fRsbDelta;
      46               0 :         return adjust;
      47                 : #endif
      48                 :     }
      49                 : private:
      50                 :     int   fPrevRsbDelta;
      51                 : };
      52                 : 
      53                 : #endif
      54                 : 

Generated by: LCOV version 1.7