diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkAdvancedTypefaceMetrics.cpp | 2 | ||||
-rw-r--r-- | src/core/SkEdge.cpp | 6 | ||||
-rw-r--r-- | src/core/SkEdge.h | 12 | ||||
-rw-r--r-- | src/core/SkGlyphCache.cpp | 2 |
4 files changed, 17 insertions, 5 deletions
diff --git a/src/core/SkAdvancedTypefaceMetrics.cpp b/src/core/SkAdvancedTypefaceMetrics.cpp index 370616ef95..b647ada260 100644 --- a/src/core/SkAdvancedTypefaceMetrics.cpp +++ b/src/core/SkAdvancedTypefaceMetrics.cpp @@ -13,7 +13,7 @@ SK_DEFINE_INST_COUNT(SkAdvancedTypefaceMetrics) #if defined(SK_BUILD_FOR_WIN) -#include <DWrite.h> +#include <dwrite.h> #endif #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) diff --git a/src/core/SkEdge.cpp b/src/core/SkEdge.cpp index fff3dbcc6a..e646c4765f 100644 --- a/src/core/SkEdge.cpp +++ b/src/core/SkEdge.cpp @@ -72,8 +72,9 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip, } SkFixed slope = SkFDot6Div(x1 - x0, y1 - y0); + const int dy = SkEdge_Compute_DY(top, y0); - fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63)); // + SK_Fixed1/2 + fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, dy)); // + SK_Fixed1/2 fDX = slope; fFirstY = top; fLastY = bot - 1; @@ -112,8 +113,9 @@ int SkEdge::updateLine(SkFixed x0, SkFixed y0, SkFixed x1, SkFixed y1) x1 >>= 10; SkFixed slope = SkFDot6Div(x1 - x0, y1 - y0); + const int dy = SkEdge_Compute_DY(top, y0); - fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63)); // + SK_Fixed1/2 + fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, dy)); // + SK_Fixed1/2 fDX = slope; fFirstY = top; fLastY = bot - 1; diff --git a/src/core/SkEdge.h b/src/core/SkEdge.h index 53678621c3..c36ba246ce 100644 --- a/src/core/SkEdge.h +++ b/src/core/SkEdge.h @@ -14,6 +14,15 @@ #include "SkFDot6.h" #include "SkMath.h" +//#ifdef SK_IGNORE_SETLINE_FIX +#if 1 + #define SkEdge_Compute_DY(top, y0) ((32 - (y0)) & 63) +#else + // This is correct, as it favors the lower-pixel when y0 is on a 1/2 pixel + // boundary, returning 64 instead of the old code, which returns 0. + #define SkEdge_Compute_DY(top, y0) ((top << 6) + 32 - (y0)) +#endif + struct SkEdge { enum Type { kLine_Type, @@ -118,8 +127,9 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) { } SkFixed slope = SkFDot6Div(x1 - x0, y1 - y0); + const int dy = SkEdge_Compute_DY(top, y0); - fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, (32 - y0) & 63)); // + SK_Fixed1/2 + fX = SkFDot6ToFixed(x0 + SkFixedMul(slope, dy)); // + SK_Fixed1/2 fDX = slope; fFirstY = top; fLastY = bot - 1; diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 5904edd3c0..ae213e94b5 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -599,7 +599,7 @@ void SkGlyphCache::AttachCache(SkGlyphCache* cache) { // if we have a fixed budget for our cache, do a purge here { size_t allocated = globals.fTotalMemoryUsed + cache->fMemoryUsed; - size_t budgeted = SkGraphics::GetFontCacheLimit(); + size_t budgeted = globals.getFontCacheLimit(); if (allocated > budgeted) { (void)InternalFreeCache(&globals, allocated - budgeted); } |