OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 SkScalar originX = WebCoreFloatToSkScalar(pt.x()); | 628 SkScalar originX = WebCoreFloatToSkScalar(pt.x()); |
629 | 629 |
630 // Offset it vertically by 1 so that there's some space under the text. | 630 // Offset it vertically by 1 so that there's some space under the text. |
631 SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1; | 631 SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1; |
632 originX *= deviceScaleFactor; | 632 originX *= deviceScaleFactor; |
633 originY *= deviceScaleFactor; | 633 originY *= deviceScaleFactor; |
634 #endif | 634 #endif |
635 | 635 |
636 SkMatrix localMatrix; | 636 SkMatrix localMatrix; |
637 localMatrix.setTranslate(originX, originY); | 637 localMatrix.setTranslate(originX, originY); |
638 RefPtr<SkShader> shader = adoptRef(SkShader::CreateBitmapShader( | 638 auto shader = SkShader::MakeBitmapShader( |
639 *misspellBitmap[index], SkShader::kRepeat_TileMode, SkShader::kRepeat_Ti leMode, &localMatrix)); | 639 *misspellBitmap[index], SkShader::kRepeat_TileMode, SkShader::kRepeat_Ti leMode, &localMatrix); |
640 | 640 |
641 SkPaint paint; | 641 SkPaint paint; |
642 paint.setShader(shader.get()); | 642 paint.setShader(std::move(shader)); |
reed1
2016/03/09 21:09:06
what to push this up 3 lines, and eliminate the na
f(malita)
2016/03/10 13:57:57
Done.
| |
643 | 643 |
644 SkRect rect; | 644 SkRect rect; |
645 rect.set(originX, originY, originX + WebCoreFloatToSkScalar(width) * deviceS caleFactor, originY + SkIntToScalar(misspellBitmap[index]->height())); | 645 rect.set(originX, originY, originX + WebCoreFloatToSkScalar(width) * deviceS caleFactor, originY + SkIntToScalar(misspellBitmap[index]->height())); |
646 | 646 |
647 if (deviceScaleFactor == 2) { | 647 if (deviceScaleFactor == 2) { |
648 save(); | 648 save(); |
649 scale(0.5, 0.5); | 649 scale(0.5, 0.5); |
650 } | 650 } |
651 drawRect(rect, paint); | 651 drawRect(rect, paint); |
652 if (deviceScaleFactor == 2) | 652 if (deviceScaleFactor == 2) |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1360 static const SkPMColor colors[] = { | 1360 static const SkPMColor colors[] = { |
1361 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1361 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
1362 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1362 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
1363 }; | 1363 }; |
1364 | 1364 |
1365 return colors[index]; | 1365 return colors[index]; |
1366 } | 1366 } |
1367 #endif | 1367 #endif |
1368 | 1368 |
1369 } // namespace blink | 1369 } // namespace blink |
OLD | NEW |