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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0; | 791 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0; |
792 static SkBitmap* misspellBitmap1x[2] = { 0, 0 }; | 792 static SkBitmap* misspellBitmap1x[2] = { 0, 0 }; |
793 static SkBitmap* misspellBitmap2x[2] = { 0, 0 }; | 793 static SkBitmap* misspellBitmap2x[2] = { 0, 0 }; |
794 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss
pellBitmap1x; | 794 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss
pellBitmap1x; |
795 if (!misspellBitmap[index]) { | 795 if (!misspellBitmap[index]) { |
796 #if OS(MACOSX) | 796 #if OS(MACOSX) |
797 // Match the artwork used by the Mac. | 797 // Match the artwork used by the Mac. |
798 const int rowPixels = 4 * deviceScaleFactor; | 798 const int rowPixels = 4 * deviceScaleFactor; |
799 const int colPixels = 3 * deviceScaleFactor; | 799 const int colPixels = 3 * deviceScaleFactor; |
800 SkBitmap bitmap; | 800 SkBitmap bitmap; |
801 if (!bitmap.allocN32Pixels(rowPixels, colPixels)) | 801 if (!bitmap.tryAllocN32Pixels(rowPixels, colPixels)) |
802 return; | 802 return; |
803 | 803 |
804 bitmap.eraseARGB(0, 0, 0, 0); | 804 bitmap.eraseARGB(0, 0, 0, 0); |
805 const uint32_t transparentColor = 0x00000000; | 805 const uint32_t transparentColor = 0x00000000; |
806 | 806 |
807 if (deviceScaleFactor == 1) { | 807 if (deviceScaleFactor == 1) { |
808 const uint32_t colors[2][6] = { | 808 const uint32_t colors[2][6] = { |
809 { 0x2a2a0600, 0x57571000, 0xa8a81b00, 0xbfbf1f00, 0x70701200,
0xe0e02400 }, | 809 { 0x2a2a0600, 0x57571000, 0xa8a81b00, 0xbfbf1f00, 0x70701200,
0xe0e02400 }, |
810 { 0x2a0f0f0f, 0x571e1e1e, 0xa83d3d3d, 0xbf454545, 0x70282828,
0xe0515151 } | 810 { 0x2a0f0f0f, 0x571e1e1e, 0xa83d3d3d, 0xbf454545, 0x70282828,
0xe0515151 } |
811 }; | 811 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 ASSERT_NOT_REACHED(); | 849 ASSERT_NOT_REACHED(); |
850 | 850 |
851 misspellBitmap[index] = new SkBitmap(bitmap); | 851 misspellBitmap[index] = new SkBitmap(bitmap); |
852 #else | 852 #else |
853 // We use a 2-pixel-high misspelling indicator because that seems to be | 853 // We use a 2-pixel-high misspelling indicator because that seems to be |
854 // what WebKit is designed for, and how much room there is in a typical | 854 // what WebKit is designed for, and how much room there is in a typical |
855 // page for it. | 855 // page for it. |
856 const int rowPixels = 32 * deviceScaleFactor; // Must be multiple of 4 f
or pattern below. | 856 const int rowPixels = 32 * deviceScaleFactor; // Must be multiple of 4 f
or pattern below. |
857 const int colPixels = 2 * deviceScaleFactor; | 857 const int colPixels = 2 * deviceScaleFactor; |
858 SkBitmap bitmap; | 858 SkBitmap bitmap; |
859 if (!bitmap.allocN32Pixels(rowPixels, colPixels)) | 859 if (!bitmap.tryAllocN32Pixels(rowPixels, colPixels)) |
860 return; | 860 return; |
861 | 861 |
862 bitmap.eraseARGB(0, 0, 0, 0); | 862 bitmap.eraseARGB(0, 0, 0, 0); |
863 if (deviceScaleFactor == 1) | 863 if (deviceScaleFactor == 1) |
864 draw1xMarker(&bitmap, index); | 864 draw1xMarker(&bitmap, index); |
865 else if (deviceScaleFactor == 2) | 865 else if (deviceScaleFactor == 2) |
866 draw2xMarker(&bitmap, index); | 866 draw2xMarker(&bitmap, index); |
867 else | 867 else |
868 ASSERT_NOT_REACHED(); | 868 ASSERT_NOT_REACHED(); |
869 | 869 |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1961 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1962 // being set to true). We need to decide if we respect InterpolationNone | 1962 // being set to true). We need to decide if we respect InterpolationNone |
1963 // being returned from computeInterpolationQuality. | 1963 // being returned from computeInterpolationQuality. |
1964 resampling = InterpolationLow; | 1964 resampling = InterpolationLow; |
1965 } | 1965 } |
1966 resampling = limitInterpolationQuality(this, resampling); | 1966 resampling = limitInterpolationQuality(this, resampling); |
1967 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); | 1967 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); |
1968 } | 1968 } |
1969 | 1969 |
1970 } // namespace blink | 1970 } // namespace blink |
OLD | NEW |