1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/patches/archive/0015-Bug-766017-warnings.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,865 @@ 1.4 +From: David Zbarsky <dzbarsky@gmail.com> 1.5 +Bug 766017 - Fix some skia warnings r=gw280 1.6 + 1.7 +diff --git a/gfx/skia/include/utils/mac/SkCGUtils.h b/gfx/skia/include/utils/mac/SkCGUtils.h 1.8 +--- a/gfx/skia/include/utils/mac/SkCGUtils.h 1.9 ++++ b/gfx/skia/include/utils/mac/SkCGUtils.h 1.10 +@@ -39,18 +39,16 @@ static inline CGImageRef SkCreateCGImage 1.11 + /** 1.12 + * Draw the bitmap into the specified CG context. The bitmap will be converted 1.13 + * to a CGImage using the generic RGB colorspace. (x,y) specifies the position 1.14 + * of the top-left corner of the bitmap. The bitmap is converted using the 1.15 + * colorspace returned by CGColorSpaceCreateDeviceRGB() 1.16 + */ 1.17 + void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y); 1.18 + 1.19 +-bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output); 1.20 +- 1.21 + /** 1.22 + * Return a provider that wraps the specified stream. It will become an 1.23 + * owner of the stream, so the caller must still manage its ownership. 1.24 + * 1.25 + * To hand-off ownership of the stream to the provider, the caller must do 1.26 + * something like the following: 1.27 + * 1.28 + * SkStream* stream = new ...; 1.29 +diff --git a/gfx/skia/src/core/SkAAClip.cpp b/gfx/skia/src/core/SkAAClip.cpp 1.30 +--- a/gfx/skia/src/core/SkAAClip.cpp 1.31 ++++ b/gfx/skia/src/core/SkAAClip.cpp 1.32 +@@ -246,17 +246,17 @@ static void count_left_right_zeros(const 1.33 + zeros = 0; 1.34 + } 1.35 + row += 2; 1.36 + width -= n; 1.37 + } 1.38 + *riteZ = zeros; 1.39 + } 1.40 + 1.41 +-#ifdef SK_DEBUG 1.42 ++#if 0 1.43 + static void test_count_left_right_zeros() { 1.44 + static bool gOnce; 1.45 + if (gOnce) { 1.46 + return; 1.47 + } 1.48 + gOnce = true; 1.49 + 1.50 + const uint8_t data0[] = { 0, 0, 10, 0xFF }; 1.51 +@@ -1319,22 +1319,16 @@ bool SkAAClip::setPath(const SkPath& pat 1.52 + } 1.53 + 1.54 + /////////////////////////////////////////////////////////////////////////////// 1.55 + 1.56 + typedef void (*RowProc)(SkAAClip::Builder&, int bottom, 1.57 + const uint8_t* rowA, const SkIRect& rectA, 1.58 + const uint8_t* rowB, const SkIRect& rectB); 1.59 + 1.60 +-static void sectRowProc(SkAAClip::Builder& builder, int bottom, 1.61 +- const uint8_t* rowA, const SkIRect& rectA, 1.62 +- const uint8_t* rowB, const SkIRect& rectB) { 1.63 +- 1.64 +-} 1.65 +- 1.66 + typedef U8CPU (*AlphaProc)(U8CPU alphaA, U8CPU alphaB); 1.67 + 1.68 + static U8CPU sectAlphaProc(U8CPU alphaA, U8CPU alphaB) { 1.69 + // Multiply 1.70 + return SkMulDiv255Round(alphaA, alphaB); 1.71 + } 1.72 + 1.73 + static U8CPU unionAlphaProc(U8CPU alphaA, U8CPU alphaB) { 1.74 +@@ -1429,31 +1423,16 @@ private: 1.75 + static void adjust_row(RowIter& iter, int& leftA, int& riteA, int rite) { 1.76 + if (rite == riteA) { 1.77 + iter.next(); 1.78 + leftA = iter.left(); 1.79 + riteA = iter.right(); 1.80 + } 1.81 + } 1.82 + 1.83 +-static bool intersect(int& min, int& max, int boundsMin, int boundsMax) { 1.84 +- SkASSERT(min < max); 1.85 +- SkASSERT(boundsMin < boundsMax); 1.86 +- if (min >= boundsMax || max <= boundsMin) { 1.87 +- return false; 1.88 +- } 1.89 +- if (min < boundsMin) { 1.90 +- min = boundsMin; 1.91 +- } 1.92 +- if (max > boundsMax) { 1.93 +- max = boundsMax; 1.94 +- } 1.95 +- return true; 1.96 +-} 1.97 +- 1.98 + static void operatorX(SkAAClip::Builder& builder, int lastY, 1.99 + RowIter& iterA, RowIter& iterB, 1.100 + AlphaProc proc, const SkIRect& bounds) { 1.101 + int leftA = iterA.left(); 1.102 + int riteA = iterA.right(); 1.103 + int leftB = iterB.left(); 1.104 + int riteB = iterB.right(); 1.105 + 1.106 +@@ -1970,34 +1949,33 @@ static void small_bzero(void* dst, size_ 1.107 + static inline uint8_t mergeOne(uint8_t value, unsigned alpha) { 1.108 + return SkMulDiv255Round(value, alpha); 1.109 + } 1.110 + static inline uint16_t mergeOne(uint16_t value, unsigned alpha) { 1.111 + unsigned r = SkGetPackedR16(value); 1.112 + unsigned g = SkGetPackedG16(value); 1.113 + unsigned b = SkGetPackedB16(value); 1.114 + return SkPackRGB16(SkMulDiv255Round(r, alpha), 1.115 +- SkMulDiv255Round(r, alpha), 1.116 +- SkMulDiv255Round(r, alpha)); 1.117 ++ SkMulDiv255Round(g, alpha), 1.118 ++ SkMulDiv255Round(b, alpha)); 1.119 + } 1.120 + static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) { 1.121 + unsigned a = SkGetPackedA32(value); 1.122 + unsigned r = SkGetPackedR32(value); 1.123 + unsigned g = SkGetPackedG32(value); 1.124 + unsigned b = SkGetPackedB32(value); 1.125 + return SkPackARGB32(SkMulDiv255Round(a, alpha), 1.126 + SkMulDiv255Round(r, alpha), 1.127 + SkMulDiv255Round(g, alpha), 1.128 + SkMulDiv255Round(b, alpha)); 1.129 + } 1.130 + 1.131 + template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN, 1.132 + const uint8_t* SK_RESTRICT row, int rowN, 1.133 + T* SK_RESTRICT dst) { 1.134 +- SkDEBUGCODE(int accumulated = 0;) 1.135 + for (;;) { 1.136 + SkASSERT(rowN > 0); 1.137 + SkASSERT(srcN > 0); 1.138 + 1.139 + int n = SkMin32(rowN, srcN); 1.140 + unsigned rowA = row[1]; 1.141 + if (0xFF == rowA) { 1.142 + small_memcpy(dst, src, n * sizeof(T)); 1.143 +diff --git a/gfx/skia/src/core/SkBlitMask_D32.cpp b/gfx/skia/src/core/SkBlitMask_D32.cpp 1.144 +--- a/gfx/skia/src/core/SkBlitMask_D32.cpp 1.145 ++++ b/gfx/skia/src/core/SkBlitMask_D32.cpp 1.146 +@@ -268,107 +268,49 @@ bool SkBlitMask::BlitColor(const SkBitma 1.147 + return true; 1.148 + } 1.149 + return false; 1.150 + } 1.151 + 1.152 + /////////////////////////////////////////////////////////////////////////////// 1.153 + /////////////////////////////////////////////////////////////////////////////// 1.154 + 1.155 +-static void BW_RowProc_Blend(SkPMColor* SK_RESTRICT dst, 1.156 +- const uint8_t* SK_RESTRICT mask, 1.157 +- const SkPMColor* SK_RESTRICT src, int count) { 1.158 +- int i, octuple = (count + 7) >> 3; 1.159 +- for (i = 0; i < octuple; ++i) { 1.160 +- int m = *mask++; 1.161 +- if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); } 1.162 +- if (m & 0x40) { dst[1] = SkPMSrcOver(src[1], dst[1]); } 1.163 +- if (m & 0x20) { dst[2] = SkPMSrcOver(src[2], dst[2]); } 1.164 +- if (m & 0x10) { dst[3] = SkPMSrcOver(src[3], dst[3]); } 1.165 +- if (m & 0x08) { dst[4] = SkPMSrcOver(src[4], dst[4]); } 1.166 +- if (m & 0x04) { dst[5] = SkPMSrcOver(src[5], dst[5]); } 1.167 +- if (m & 0x02) { dst[6] = SkPMSrcOver(src[6], dst[6]); } 1.168 +- if (m & 0x01) { dst[7] = SkPMSrcOver(src[7], dst[7]); } 1.169 +- src += 8; 1.170 +- dst += 8; 1.171 +- } 1.172 +- count &= 7; 1.173 +- if (count > 0) { 1.174 +- int m = *mask; 1.175 +- do { 1.176 +- if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); } 1.177 +- m <<= 1; 1.178 +- src += 1; 1.179 +- dst += 1; 1.180 +- } while (--count > 0); 1.181 +- } 1.182 +-} 1.183 +- 1.184 +-static void BW_RowProc_Opaque(SkPMColor* SK_RESTRICT dst, 1.185 +- const uint8_t* SK_RESTRICT mask, 1.186 +- const SkPMColor* SK_RESTRICT src, int count) { 1.187 +- int i, octuple = (count + 7) >> 3; 1.188 +- for (i = 0; i < octuple; ++i) { 1.189 +- int m = *mask++; 1.190 +- if (m & 0x80) { dst[0] = src[0]; } 1.191 +- if (m & 0x40) { dst[1] = src[1]; } 1.192 +- if (m & 0x20) { dst[2] = src[2]; } 1.193 +- if (m & 0x10) { dst[3] = src[3]; } 1.194 +- if (m & 0x08) { dst[4] = src[4]; } 1.195 +- if (m & 0x04) { dst[5] = src[5]; } 1.196 +- if (m & 0x02) { dst[6] = src[6]; } 1.197 +- if (m & 0x01) { dst[7] = src[7]; } 1.198 +- src += 8; 1.199 +- dst += 8; 1.200 +- } 1.201 +- count &= 7; 1.202 +- if (count > 0) { 1.203 +- int m = *mask; 1.204 +- do { 1.205 +- if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); } 1.206 +- m <<= 1; 1.207 +- src += 1; 1.208 +- dst += 1; 1.209 +- } while (--count > 0); 1.210 +- } 1.211 +-} 1.212 +- 1.213 + static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst, 1.214 + const uint8_t* SK_RESTRICT mask, 1.215 + const SkPMColor* SK_RESTRICT src, int count) { 1.216 + for (int i = 0; i < count; ++i) { 1.217 + if (mask[i]) { 1.218 + dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]); 1.219 + } 1.220 + } 1.221 + } 1.222 + 1.223 + // expand the steps that SkAlphaMulQ performs, but this way we can 1.224 +-// exand.. add.. combine 1.225 ++// expand.. add.. combine 1.226 + // instead of 1.227 + // expand..combine add expand..combine 1.228 + // 1.229 + #define EXPAND0(v, m, s) ((v) & (m)) * (s) 1.230 + #define EXPAND1(v, m, s) (((v) >> 8) & (m)) * (s) 1.231 + #define COMBINE(e0, e1, m) ((((e0) >> 8) & (m)) | ((e1) & ~(m))) 1.232 + 1.233 + static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst, 1.234 + const uint8_t* SK_RESTRICT mask, 1.235 + const SkPMColor* SK_RESTRICT src, int count) { 1.236 +- const uint32_t rbmask = gMask_00FF00FF; 1.237 + for (int i = 0; i < count; ++i) { 1.238 + int m = mask[i]; 1.239 + if (m) { 1.240 + m += (m >> 7); 1.241 + #if 1 1.242 + // this is slightly slower than the expand/combine version, but it 1.243 + // is much closer to the old results, so we use it for now to reduce 1.244 + // rebaselining. 1.245 + dst[i] = SkAlphaMulQ(src[i], m) + SkAlphaMulQ(dst[i], 256 - m); 1.246 + #else 1.247 ++ const uint32_t rbmask = gMask_00FF00FF; 1.248 + uint32_t v = src[i]; 1.249 + uint32_t s0 = EXPAND0(v, rbmask, m); 1.250 + uint32_t s1 = EXPAND1(v, rbmask, m); 1.251 + v = dst[i]; 1.252 + uint32_t d0 = EXPAND0(v, rbmask, m); 1.253 + uint32_t d1 = EXPAND1(v, rbmask, m); 1.254 + dst[i] = COMBINE(s0 + d0, s1 + d1, rbmask); 1.255 + #endif 1.256 +@@ -559,17 +501,17 @@ SkBlitMask::RowProc SkBlitMask::RowFacto 1.257 + // make this opt-in until chrome can rebaseline 1.258 + RowProc proc = PlatformRowProcs(config, format, flags); 1.259 + if (proc) { 1.260 + return proc; 1.261 + } 1.262 + 1.263 + static const RowProc gProcs[] = { 1.264 + // need X coordinate to handle BW 1.265 +- NULL, NULL, //(RowProc)BW_RowProc_Blend, (RowProc)BW_RowProc_Opaque, 1.266 ++ NULL, NULL, 1.267 + (RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque, 1.268 + (RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque, 1.269 + (RowProc)LCD32_RowProc_Blend, (RowProc)LCD32_RowProc_Opaque, 1.270 + }; 1.271 + 1.272 + int index; 1.273 + switch (config) { 1.274 + case SkBitmap::kARGB_8888_Config: 1.275 +diff --git a/gfx/skia/src/core/SkConcaveToTriangles.cpp b/gfx/skia/src/core/SkConcaveToTriangles.cpp 1.276 +--- a/gfx/skia/src/core/SkConcaveToTriangles.cpp 1.277 ++++ b/gfx/skia/src/core/SkConcaveToTriangles.cpp 1.278 +@@ -37,17 +37,16 @@ 1.279 + #include "SkTDArray.h" 1.280 + #include "SkGeometry.h" 1.281 + #include "SkTSort.h" 1.282 + 1.283 + // This is used to prevent runaway code bugs, and can probably be removed after 1.284 + // the code has been proven robust. 1.285 + #define kMaxCount 1000 1.286 + 1.287 +-#define DEBUG 1.288 + #ifdef DEBUG 1.289 + //------------------------------------------------------------------------------ 1.290 + // Debugging support 1.291 + //------------------------------------------------------------------------------ 1.292 + 1.293 + #include <cstdio> 1.294 + #include <stdarg.h> 1.295 + 1.296 +diff --git a/gfx/skia/src/core/SkPath.cpp b/gfx/skia/src/core/SkPath.cpp 1.297 +--- a/gfx/skia/src/core/SkPath.cpp 1.298 ++++ b/gfx/skia/src/core/SkPath.cpp 1.299 +@@ -469,17 +469,16 @@ void SkPath::incReserve(U16CPU inc) { 1.300 + fPts.setReserve(fPts.count() + inc); 1.301 + 1.302 + SkDEBUGCODE(this->validate();) 1.303 + } 1.304 + 1.305 + void SkPath::moveTo(SkScalar x, SkScalar y) { 1.306 + SkDEBUGCODE(this->validate();) 1.307 + 1.308 +- int vc = fVerbs.count(); 1.309 + SkPoint* pt; 1.310 + 1.311 + // remember our index 1.312 + fLastMoveToIndex = fPts.count(); 1.313 + 1.314 + pt = fPts.append(); 1.315 + *fVerbs.append() = kMove_Verb; 1.316 + pt->set(x, y); 1.317 +@@ -1163,17 +1162,16 @@ void SkPath::reversePathTo(const SkPath& 1.318 + } 1.319 + pts -= gPtsInVerb[verbs[i]]; 1.320 + } 1.321 + } 1.322 + 1.323 + void SkPath::reverseAddPath(const SkPath& src) { 1.324 + this->incReserve(src.fPts.count()); 1.325 + 1.326 +- const SkPoint* startPts = src.fPts.begin(); 1.327 + const SkPoint* pts = src.fPts.end(); 1.328 + const uint8_t* startVerbs = src.fVerbs.begin(); 1.329 + const uint8_t* verbs = src.fVerbs.end(); 1.330 + 1.331 + fIsOval = false; 1.332 + 1.333 + bool needMove = true; 1.334 + bool needClose = false; 1.335 +diff --git a/gfx/skia/src/core/SkRegion.cpp b/gfx/skia/src/core/SkRegion.cpp 1.336 +--- a/gfx/skia/src/core/SkRegion.cpp 1.337 ++++ b/gfx/skia/src/core/SkRegion.cpp 1.338 +@@ -920,20 +920,16 @@ static int operate(const SkRegion::RunTy 1.339 + /* Given count RunTypes in a complex region, return the worst case number of 1.340 + logical intervals that represents (i.e. number of rects that would be 1.341 + returned from the iterator). 1.342 + 1.343 + We could just return count/2, since there must be at least 2 values per 1.344 + interval, but we can first trim off the const overhead of the initial TOP 1.345 + value, plus the final BOTTOM + 2 sentinels. 1.346 + */ 1.347 +-static int count_to_intervals(int count) { 1.348 +- SkASSERT(count >= 6); // a single rect is 6 values 1.349 +- return (count - 4) >> 1; 1.350 +-} 1.351 + 1.352 + /* Given a number of intervals, what is the worst case representation of that 1.353 + many intervals? 1.354 + 1.355 + Worst case (from a storage perspective), is a vertical stack of single 1.356 + intervals: TOP + N * (BOTTOM INTERVALCOUNT LEFT RIGHT SENTINEL) + SENTINEL 1.357 + */ 1.358 + static int intervals_to_count(int intervals) { 1.359 +diff --git a/gfx/skia/src/core/SkScalerContext.cpp b/gfx/skia/src/core/SkScalerContext.cpp 1.360 +--- a/gfx/skia/src/core/SkScalerContext.cpp 1.361 ++++ b/gfx/skia/src/core/SkScalerContext.cpp 1.362 +@@ -336,44 +336,16 @@ SK_ERROR: 1.363 + glyph->fTop = 0; 1.364 + glyph->fWidth = 0; 1.365 + glyph->fHeight = 0; 1.366 + // put a valid value here, in case it was earlier set to 1.367 + // MASK_FORMAT_JUST_ADVANCE 1.368 + glyph->fMaskFormat = fRec.fMaskFormat; 1.369 + } 1.370 + 1.371 +-static bool isLCD(const SkScalerContext::Rec& rec) { 1.372 +- return SkMask::kLCD16_Format == rec.fMaskFormat || 1.373 +- SkMask::kLCD32_Format == rec.fMaskFormat; 1.374 +-} 1.375 +- 1.376 +-static uint16_t a8_to_rgb565(unsigned a8) { 1.377 +- return SkPackRGB16(a8 >> 3, a8 >> 2, a8 >> 3); 1.378 +-} 1.379 +- 1.380 +-static void copyToLCD16(const SkBitmap& src, const SkMask& dst) { 1.381 +- SkASSERT(SkBitmap::kA8_Config == src.config()); 1.382 +- SkASSERT(SkMask::kLCD16_Format == dst.fFormat); 1.383 +- 1.384 +- const int width = dst.fBounds.width(); 1.385 +- const int height = dst.fBounds.height(); 1.386 +- const uint8_t* srcP = src.getAddr8(0, 0); 1.387 +- size_t srcRB = src.rowBytes(); 1.388 +- uint16_t* dstP = (uint16_t*)dst.fImage; 1.389 +- size_t dstRB = dst.fRowBytes; 1.390 +- for (int y = 0; y < height; ++y) { 1.391 +- for (int x = 0; x < width; ++x) { 1.392 +- dstP[x] = a8_to_rgb565(srcP[x]); 1.393 +- } 1.394 +- srcP += srcRB; 1.395 +- dstP = (uint16_t*)((char*)dstP + dstRB); 1.396 +- } 1.397 +-} 1.398 +- 1.399 + #define SK_FREETYPE_LCD_LERP 160 1.400 + 1.401 + static int lerp(int start, int end) { 1.402 + SkASSERT((unsigned)SK_FREETYPE_LCD_LERP <= 256); 1.403 + return start + ((end - start) * (SK_FREETYPE_LCD_LERP) >> 8); 1.404 + } 1.405 + 1.406 + static uint16_t packLCD16(unsigned r, unsigned g, unsigned b) { 1.407 +diff --git a/gfx/skia/src/core/SkScan_AntiPath.cpp b/gfx/skia/src/core/SkScan_AntiPath.cpp 1.408 +--- a/gfx/skia/src/core/SkScan_AntiPath.cpp 1.409 ++++ b/gfx/skia/src/core/SkScan_AntiPath.cpp 1.410 +@@ -230,52 +230,16 @@ void SuperBlitter::blitH(int x, int y, i 1.411 + fOffsetX); 1.412 + 1.413 + #ifdef SK_DEBUG 1.414 + fRuns.assertValid(y & MASK, (1 << (8 - SHIFT))); 1.415 + fCurrX = x + width; 1.416 + #endif 1.417 + } 1.418 + 1.419 +-static void set_left_rite_runs(SkAlphaRuns& runs, int ileft, U8CPU leftA, 1.420 +- int n, U8CPU riteA) { 1.421 +- SkASSERT(leftA <= 0xFF); 1.422 +- SkASSERT(riteA <= 0xFF); 1.423 +- 1.424 +- int16_t* run = runs.fRuns; 1.425 +- uint8_t* aa = runs.fAlpha; 1.426 +- 1.427 +- if (ileft > 0) { 1.428 +- run[0] = ileft; 1.429 +- aa[0] = 0; 1.430 +- run += ileft; 1.431 +- aa += ileft; 1.432 +- } 1.433 +- 1.434 +- SkASSERT(leftA < 0xFF); 1.435 +- if (leftA > 0) { 1.436 +- *run++ = 1; 1.437 +- *aa++ = leftA; 1.438 +- } 1.439 +- 1.440 +- if (n > 0) { 1.441 +- run[0] = n; 1.442 +- aa[0] = 0xFF; 1.443 +- run += n; 1.444 +- aa += n; 1.445 +- } 1.446 +- 1.447 +- SkASSERT(riteA < 0xFF); 1.448 +- if (riteA > 0) { 1.449 +- *run++ = 1; 1.450 +- *aa++ = riteA; 1.451 +- } 1.452 +- run[0] = 0; 1.453 +-} 1.454 +- 1.455 + void SuperBlitter::blitRect(int x, int y, int width, int height) { 1.456 + SkASSERT(width > 0); 1.457 + SkASSERT(height > 0); 1.458 + 1.459 + // blit leading rows 1.460 + while ((y & MASK)) { 1.461 + this->blitH(x, y++, width); 1.462 + if (--height <= 0) { 1.463 +diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp 1.464 +--- a/gfx/skia/src/effects/SkGradientShader.cpp 1.465 ++++ b/gfx/skia/src/effects/SkGradientShader.cpp 1.466 +@@ -865,45 +865,16 @@ bool Linear_Gradient::setContext(const S 1.467 + } while (0) 1.468 + 1.469 + namespace { 1.470 + 1.471 + typedef void (*LinearShadeProc)(TileProc proc, SkFixed dx, SkFixed fx, 1.472 + SkPMColor* dstC, const SkPMColor* cache, 1.473 + int toggle, int count); 1.474 + 1.475 +-// This function is deprecated, and will be replaced by 1.476 +-// shadeSpan_linear_vertical_lerp() once Chrome has been weaned off of it. 1.477 +-void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx, 1.478 +- SkPMColor* SK_RESTRICT dstC, 1.479 +- const SkPMColor* SK_RESTRICT cache, 1.480 +- int toggle, int count) { 1.481 +- if (proc == clamp_tileproc) { 1.482 +- // Read out clamp values from beginning/end of the cache. No need to lerp 1.483 +- // or dither 1.484 +- if (fx < 0) { 1.485 +- sk_memset32(dstC, cache[-1], count); 1.486 +- return; 1.487 +- } else if (fx > 0xFFFF) { 1.488 +- sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count); 1.489 +- return; 1.490 +- } 1.491 +- } 1.492 +- 1.493 +- // We're a vertical gradient, so no change in a span. 1.494 +- // If colors change sharply across the gradient, dithering is 1.495 +- // insufficient (it subsamples the color space) and we need to lerp. 1.496 +- unsigned fullIndex = proc(fx); 1.497 +- unsigned fi = fullIndex >> (16 - Gradient_Shader::kCache32Bits); 1.498 +- sk_memset32_dither(dstC, 1.499 +- cache[toggle + fi], 1.500 +- cache[(toggle ^ Gradient_Shader::kDitherStride32) + fi], 1.501 +- count); 1.502 +-} 1.503 +- 1.504 + // Linear interpolation (lerp) is unnecessary if there are no sharp 1.505 + // discontinuities in the gradient - which must be true if there are 1.506 + // only 2 colors - but it's cheap. 1.507 + void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx, 1.508 + SkPMColor* SK_RESTRICT dstC, 1.509 + const SkPMColor* SK_RESTRICT cache, 1.510 + int toggle, int count) { 1.511 + if (proc == clamp_tileproc) { 1.512 +@@ -2131,16 +2102,18 @@ protected: 1.513 + buffer.writePoint(fCenter); 1.514 + } 1.515 + 1.516 + private: 1.517 + typedef Gradient_Shader INHERITED; 1.518 + const SkPoint fCenter; 1.519 + }; 1.520 + 1.521 ++#ifndef SK_SCALAR_IS_FLOAT 1.522 ++ 1.523 + #ifdef COMPUTE_SWEEP_TABLE 1.524 + #define PI 3.14159265 1.525 + static bool gSweepTableReady; 1.526 + static uint8_t gSweepTable[65]; 1.527 + 1.528 + /* Our table stores precomputed values for atan: [0...1] -> [0..PI/4] 1.529 + We scale the results to [0..32] 1.530 + */ 1.531 +@@ -2168,20 +2141,23 @@ static const uint8_t gSweepTable[] = { 1.532 + 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 1.533 + 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 1.534 + 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 1.535 + 32 1.536 + }; 1.537 + static const uint8_t* build_sweep_table() { return gSweepTable; } 1.538 + #endif 1.539 + 1.540 ++#endif 1.541 ++ 1.542 + // divide numer/denom, with a bias of 6bits. Assumes numer <= denom 1.543 + // and denom != 0. Since our table is 6bits big (+1), this is a nice fit. 1.544 + // Same as (but faster than) SkFixedDiv(numer, denom) >> 10 1.545 + 1.546 ++#ifndef SK_SCALAR_IS_FLOAT 1.547 + //unsigned div_64(int numer, int denom); 1.548 + static unsigned div_64(int numer, int denom) { 1.549 + SkASSERT(numer <= denom); 1.550 + SkASSERT(numer > 0); 1.551 + SkASSERT(denom > 0); 1.552 + 1.553 + int nbits = SkCLZ(numer); 1.554 + int dbits = SkCLZ(denom); 1.555 +@@ -2294,16 +2270,17 @@ static unsigned atan_0_90(SkFixed y, SkF 1.556 + result = 64 - result; 1.557 + // pin to 63 1.558 + result -= result >> 6; 1.559 + } 1.560 + 1.561 + SkASSERT(result <= 63); 1.562 + return result; 1.563 + } 1.564 ++#endif 1.565 + 1.566 + // returns angle in a circle [0..2PI) -> [0..255] 1.567 + #ifdef SK_SCALAR_IS_FLOAT 1.568 + static unsigned SkATan2_255(float y, float x) { 1.569 + // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); 1.570 + static const float g255Over2PI = 40.584510488433314f; 1.571 + 1.572 + float result = sk_float_atan2(y, x); 1.573 +diff --git a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp 1.574 +--- a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp 1.575 ++++ b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp 1.576 +@@ -112,17 +112,17 @@ void BlitRect32_OpaqueWide_SSE2(SkPMColo 1.577 + } 1.578 + 1.579 + void ColorRect32_SSE2(SkPMColor* destination, 1.580 + int width, int height, 1.581 + size_t rowBytes, uint32_t color) { 1.582 + if (0 == height || 0 == width || 0 == color) { 1.583 + return; 1.584 + } 1.585 +- unsigned colorA = SkGetPackedA32(color); 1.586 ++ //unsigned colorA = SkGetPackedA32(color); 1.587 + //if (255 == colorA) { 1.588 + //if (width < 31) { 1.589 + //BlitRect32_OpaqueNarrow_SSE2(destination, width, height, 1.590 + //rowBytes, color); 1.591 + //} else { 1.592 + //BlitRect32_OpaqueWide_SSE2(destination, width, height, 1.593 + //rowBytes, color); 1.594 + //} 1.595 +diff --git a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp 1.596 +--- a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp 1.597 ++++ b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp 1.598 +@@ -75,20 +75,16 @@ static CGFloat CGRectGetMinY_inline(cons 1.599 + static CGFloat CGRectGetMaxY_inline(const CGRect& rect) { 1.600 + return rect.origin.y + rect.size.height; 1.601 + } 1.602 + 1.603 + static CGFloat CGRectGetWidth_inline(const CGRect& rect) { 1.604 + return rect.size.width; 1.605 + } 1.606 + 1.607 +-static CGFloat CGRectGetHeight(const CGRect& rect) { 1.608 +- return rect.size.height; 1.609 +-} 1.610 +- 1.611 + /////////////////////////////////////////////////////////////////////////////// 1.612 + 1.613 + static void sk_memset_rect32(uint32_t* ptr, uint32_t value, size_t width, 1.614 + size_t height, size_t rowBytes) { 1.615 + SkASSERT(width); 1.616 + SkASSERT(width * sizeof(uint32_t) <= rowBytes); 1.617 + 1.618 + if (width >= 32) { 1.619 +@@ -125,28 +121,30 @@ static void sk_memset_rect32(uint32_t* p 1.620 + *ptr++ = value; 1.621 + } while (--w > 0); 1.622 + ptr = (uint32_t*)((char*)ptr + rowBytes); 1.623 + height -= 1; 1.624 + } 1.625 + } 1.626 + } 1.627 + 1.628 ++#if 0 1.629 + // Potentially this should be made (1) public (2) optimized when width is small. 1.630 + // Also might want 16 and 32 bit version 1.631 + // 1.632 + static void sk_memset_rect(void* ptr, U8CPU byte, size_t width, size_t height, 1.633 + size_t rowBytes) { 1.634 + uint8_t* dst = (uint8_t*)ptr; 1.635 + while (height) { 1.636 + memset(dst, byte, width); 1.637 + dst += rowBytes; 1.638 + height -= 1; 1.639 + } 1.640 + } 1.641 ++#endif 1.642 + 1.643 + #include <sys/utsname.h> 1.644 + 1.645 + typedef uint32_t CGRGBPixel; 1.646 + 1.647 + static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) { 1.648 + return pixel & 0xFF; 1.649 + } 1.650 +@@ -250,23 +248,16 @@ static CGAffineTransform MatrixToCGAffin 1.651 + return CGAffineTransformMake(ScalarToCG(matrix[SkMatrix::kMScaleX]) * sx, 1.652 + -ScalarToCG(matrix[SkMatrix::kMSkewY]) * sy, 1.653 + -ScalarToCG(matrix[SkMatrix::kMSkewX]) * sx, 1.654 + ScalarToCG(matrix[SkMatrix::kMScaleY]) * sy, 1.655 + ScalarToCG(matrix[SkMatrix::kMTransX]) * sx, 1.656 + ScalarToCG(matrix[SkMatrix::kMTransY]) * sy); 1.657 + } 1.658 + 1.659 +-static void CGAffineTransformToMatrix(const CGAffineTransform& xform, SkMatrix* matrix) { 1.660 +- matrix->setAll( 1.661 +- CGToScalar(xform.a), CGToScalar(xform.c), CGToScalar(xform.tx), 1.662 +- CGToScalar(xform.b), CGToScalar(xform.d), CGToScalar(xform.ty), 1.663 +- 0, 0, SK_Scalar1); 1.664 +-} 1.665 +- 1.666 + static SkScalar getFontScale(CGFontRef cgFont) { 1.667 + int unitsPerEm = CGFontGetUnitsPerEm(cgFont); 1.668 + return SkScalarInvert(SkIntToScalar(unitsPerEm)); 1.669 + } 1.670 + 1.671 + /////////////////////////////////////////////////////////////////////////////// 1.672 + 1.673 + #define BITMAP_INFO_RGB (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host) 1.674 +@@ -1075,16 +1066,17 @@ static const uint8_t* getInverseTable(bo 1.675 + if (!gInited) { 1.676 + build_power_table(gWhiteTable, 1.5f); 1.677 + build_power_table(gTable, 2.2f); 1.678 + gInited = true; 1.679 + } 1.680 + return isWhite ? gWhiteTable : gTable; 1.681 + } 1.682 + 1.683 ++#ifdef SK_USE_COLOR_LUMINANCE 1.684 + static const uint8_t* getGammaTable(U8CPU luminance) { 1.685 + static uint8_t gGammaTables[4][256]; 1.686 + static bool gInited; 1.687 + if (!gInited) { 1.688 + #if 1 1.689 + float start = 1.1; 1.690 + float stop = 2.1; 1.691 + for (int i = 0; i < 4; ++i) { 1.692 +@@ -1097,45 +1089,49 @@ static const uint8_t* getGammaTable(U8CP 1.693 + build_power_table(gGammaTables[2], 1); 1.694 + build_power_table(gGammaTables[3], 1); 1.695 + #endif 1.696 + gInited = true; 1.697 + } 1.698 + SkASSERT(0 == (luminance >> 8)); 1.699 + return gGammaTables[luminance >> 6]; 1.700 + } 1.701 ++#endif 1.702 + 1.703 ++#ifndef SK_USE_COLOR_LUMINANCE 1.704 + static void invertGammaMask(bool isWhite, CGRGBPixel rgb[], int width, 1.705 + int height, size_t rb) { 1.706 + const uint8_t* table = getInverseTable(isWhite); 1.707 + for (int y = 0; y < height; ++y) { 1.708 + for (int x = 0; x < width; ++x) { 1.709 + uint32_t c = rgb[x]; 1.710 + int r = (c >> 16) & 0xFF; 1.711 + int g = (c >> 8) & 0xFF; 1.712 + int b = (c >> 0) & 0xFF; 1.713 + rgb[x] = (table[r] << 16) | (table[g] << 8) | table[b]; 1.714 + } 1.715 + rgb = (CGRGBPixel*)((char*)rgb + rb); 1.716 + } 1.717 + } 1.718 ++#endif 1.719 + 1.720 + static void cgpixels_to_bits(uint8_t dst[], const CGRGBPixel src[], int count) { 1.721 + while (count > 0) { 1.722 + uint8_t mask = 0; 1.723 + for (int i = 7; i >= 0; --i) { 1.724 + mask |= (CGRGBPixel_getAlpha(*src++) >> 7) << i; 1.725 + if (0 == --count) { 1.726 + break; 1.727 + } 1.728 + } 1.729 + *dst++ = mask; 1.730 + } 1.731 + } 1.732 + 1.733 ++#ifdef SK_USE_COLOR_LUMINANCE 1.734 + static int lerpScale(int dst, int src, int scale) { 1.735 + return dst + (scale * (src - dst) >> 23); 1.736 + } 1.737 + 1.738 + static CGRGBPixel lerpPixel(CGRGBPixel dst, CGRGBPixel src, 1.739 + int scaleR, int scaleG, int scaleB) { 1.740 + int sr = (src >> 16) & 0xFF; 1.741 + int sg = (src >> 8) & 0xFF; 1.742 +@@ -1147,37 +1143,31 @@ static CGRGBPixel lerpPixel(CGRGBPixel d 1.743 + int rr = lerpScale(dr, sr, scaleR); 1.744 + int rg = lerpScale(dg, sg, scaleG); 1.745 + int rb = lerpScale(db, sb, scaleB); 1.746 + return (rr << 16) | (rg << 8) | rb; 1.747 + } 1.748 + 1.749 + static void lerpPixels(CGRGBPixel dst[], const CGRGBPixel src[], int width, 1.750 + int height, int rowBytes, int lumBits) { 1.751 +-#ifdef SK_USE_COLOR_LUMINANCE 1.752 + int scaleR = (1 << 23) * SkColorGetR(lumBits) / 0xFF; 1.753 + int scaleG = (1 << 23) * SkColorGetG(lumBits) / 0xFF; 1.754 + int scaleB = (1 << 23) * SkColorGetB(lumBits) / 0xFF; 1.755 +-#else 1.756 +- int scale = (1 << 23) * lumBits / SkScalerContext::kLuminance_Max; 1.757 +- int scaleR = scale; 1.758 +- int scaleG = scale; 1.759 +- int scaleB = scale; 1.760 +-#endif 1.761 + 1.762 + for (int y = 0; y < height; ++y) { 1.763 + for (int x = 0; x < width; ++x) { 1.764 + // bit-not the src, since it was drawn from black, so we need the 1.765 + // compliment of those bits 1.766 + dst[x] = lerpPixel(dst[x], ~src[x], scaleR, scaleG, scaleB); 1.767 + } 1.768 + src = (CGRGBPixel*)((char*)src + rowBytes); 1.769 + dst = (CGRGBPixel*)((char*)dst + rowBytes); 1.770 + } 1.771 + } 1.772 ++#endif 1.773 + 1.774 + #if 1 1.775 + static inline int r32_to_16(int x) { return SkR32ToR16(x); } 1.776 + static inline int g32_to_16(int x) { return SkG32ToG16(x); } 1.777 + static inline int b32_to_16(int x) { return SkB32ToB16(x); } 1.778 + #else 1.779 + static inline int round8to5(int x) { 1.780 + return (x + 3 - (x >> 5) + (x >> 7)) >> 3; 1.781 +@@ -1212,22 +1202,21 @@ static inline uint32_t rgb_to_lcd32(CGRG 1.782 + return SkPackARGB32(0xFF, r, g, b); 1.783 + } 1.784 + 1.785 + #define BLACK_LUMINANCE_LIMIT 0x40 1.786 + #define WHITE_LUMINANCE_LIMIT 0xA0 1.787 + 1.788 + void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) { 1.789 + CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID(fBaseGlyphCount); 1.790 +- 1.791 + const bool isLCD = isLCDFormat(glyph.fMaskFormat); 1.792 ++#ifdef SK_USE_COLOR_LUMINANCE 1.793 + const bool isBW = SkMask::kBW_Format == glyph.fMaskFormat; 1.794 + const bool isA8 = !isLCD && !isBW; 1.795 +- 1.796 +-#ifdef SK_USE_COLOR_LUMINANCE 1.797 ++ 1.798 + unsigned lumBits = fRec.getLuminanceColor(); 1.799 + uint32_t xorMask = 0; 1.800 + 1.801 + if (isA8) { 1.802 + // for A8, we just want a component (they're all the same) 1.803 + lumBits = SkColorGetR(lumBits); 1.804 + } 1.805 + #else 1.806 +diff --git a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp 1.807 +--- a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp 1.808 ++++ b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp 1.809 +@@ -163,59 +163,8 @@ private: 1.810 + CGPDFDocumentRef fDoc; 1.811 + }; 1.812 + 1.813 + static void CGDataProviderReleaseData_FromMalloc(void*, const void* data, 1.814 + size_t size) { 1.815 + sk_free((void*)data); 1.816 + } 1.817 + 1.818 +-bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) { 1.819 +- size_t size = stream->getLength(); 1.820 +- void* ptr = sk_malloc_throw(size); 1.821 +- stream->read(ptr, size); 1.822 +- CGDataProviderRef data = CGDataProviderCreateWithData(NULL, ptr, size, 1.823 +- CGDataProviderReleaseData_FromMalloc); 1.824 +- if (NULL == data) { 1.825 +- return false; 1.826 +- } 1.827 +- 1.828 +- CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data); 1.829 +- CGDataProviderRelease(data); 1.830 +- if (NULL == pdf) { 1.831 +- return false; 1.832 +- } 1.833 +- SkAutoPDFRelease releaseMe(pdf); 1.834 +- 1.835 +- CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1); 1.836 +- if (NULL == page) { 1.837 +- return false; 1.838 +- } 1.839 +- 1.840 +- CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox); 1.841 +- 1.842 +- int w = (int)CGRectGetWidth(bounds); 1.843 +- int h = (int)CGRectGetHeight(bounds); 1.844 +- 1.845 +- SkBitmap bitmap; 1.846 +- bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); 1.847 +- bitmap.allocPixels(); 1.848 +- bitmap.eraseColor(SK_ColorWHITE); 1.849 +- 1.850 +- size_t bitsPerComponent; 1.851 +- CGBitmapInfo info; 1.852 +- getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL); 1.853 +- 1.854 +- CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); 1.855 +- CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h, 1.856 +- bitsPerComponent, bitmap.rowBytes(), 1.857 +- cs, info); 1.858 +- CGColorSpaceRelease(cs); 1.859 +- 1.860 +- if (ctx) { 1.861 +- CGContextDrawPDFPage(ctx, page); 1.862 +- CGContextRelease(ctx); 1.863 +- } 1.864 +- 1.865 +- output->swap(bitmap); 1.866 +- return true; 1.867 +-} 1.868 +-