Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 201213002: Remove uses of SkBitmap::Config (deprecated) from core/ and platform/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0; 773 int index = style == DocumentMarkerGrammarLineStyle ? 1 : 0;
774 static SkBitmap* misspellBitmap1x[2] = { 0, 0 }; 774 static SkBitmap* misspellBitmap1x[2] = { 0, 0 };
775 static SkBitmap* misspellBitmap2x[2] = { 0, 0 }; 775 static SkBitmap* misspellBitmap2x[2] = { 0, 0 };
776 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss pellBitmap1x; 776 SkBitmap** misspellBitmap = deviceScaleFactor == 2 ? misspellBitmap2x : miss pellBitmap1x;
777 if (!misspellBitmap[index]) { 777 if (!misspellBitmap[index]) {
778 #if OS(MACOSX) 778 #if OS(MACOSX)
779 // Match the artwork used by the Mac. 779 // Match the artwork used by the Mac.
780 const int rowPixels = 4 * deviceScaleFactor; 780 const int rowPixels = 4 * deviceScaleFactor;
781 const int colPixels = 3 * deviceScaleFactor; 781 const int colPixels = 3 * deviceScaleFactor;
782 misspellBitmap[index] = new SkBitmap; 782 misspellBitmap[index] = new SkBitmap;
783 misspellBitmap[index]->setConfig(SkBitmap::kARGB_8888_Config, 783 misspellBitmap[index]->allocN32Pixels(rowPixels, colPixels);
Stephen Chennney 2014/03/18 12:47:57 On failure, release and return without drawing, pl
jbroman 2014/03/18 13:44:52 Done. Rather than try to use "delete" here (which
784 rowPixels, colPixels);
785 misspellBitmap[index]->allocPixels();
786 784
787 misspellBitmap[index]->eraseARGB(0, 0, 0, 0); 785 misspellBitmap[index]->eraseARGB(0, 0, 0, 0);
788 const uint32_t transparentColor = 0x00000000; 786 const uint32_t transparentColor = 0x00000000;
789 787
790 if (deviceScaleFactor == 1) { 788 if (deviceScaleFactor == 1) {
791 const uint32_t colors[2][6] = { 789 const uint32_t colors[2][6] = {
792 { 0x2a2a0600, 0x57571000, 0xa8a81b00, 0xbfbf1f00, 0x70701200, 0xe0e02400 }, 790 { 0x2a2a0600, 0x57571000, 0xa8a81b00, 0xbfbf1f00, 0x70701200, 0xe0e02400 },
793 { 0x2a0f0f0f, 0x571e1e1e, 0xa83d3d3d, 0xbf454545, 0x70282828, 0xe0515151 } 791 { 0x2a0f0f0f, 0x571e1e1e, 0xa83d3d3d, 0xbf454545, 0x70282828, 0xe0515151 }
794 }; 792 };
795 793
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 } 828 }
831 } else 829 } else
832 ASSERT_NOT_REACHED(); 830 ASSERT_NOT_REACHED();
833 #else 831 #else
834 // We use a 2-pixel-high misspelling indicator because that seems to be 832 // We use a 2-pixel-high misspelling indicator because that seems to be
835 // what WebKit is designed for, and how much room there is in a typical 833 // what WebKit is designed for, and how much room there is in a typical
836 // page for it. 834 // page for it.
837 const int rowPixels = 32 * deviceScaleFactor; // Must be multiple of 4 f or pattern below. 835 const int rowPixels = 32 * deviceScaleFactor; // Must be multiple of 4 f or pattern below.
838 const int colPixels = 2 * deviceScaleFactor; 836 const int colPixels = 2 * deviceScaleFactor;
839 misspellBitmap[index] = new SkBitmap; 837 misspellBitmap[index] = new SkBitmap;
840 misspellBitmap[index]->setConfig(SkBitmap::kARGB_8888_Config, rowPixels, colPixels); 838 misspellBitmap[index]->allocN32Pixels(rowPixels, colPixels);
Stephen Chennney 2014/03/18 12:47:57 Ditto.
841 misspellBitmap[index]->allocPixels();
842 839
843 misspellBitmap[index]->eraseARGB(0, 0, 0, 0); 840 misspellBitmap[index]->eraseARGB(0, 0, 0, 0);
844 if (deviceScaleFactor == 1) 841 if (deviceScaleFactor == 1)
845 draw1xMarker(misspellBitmap[index], index); 842 draw1xMarker(misspellBitmap[index], index);
846 else if (deviceScaleFactor == 2) 843 else if (deviceScaleFactor == 2)
847 draw2xMarker(misspellBitmap[index], index); 844 draw2xMarker(misspellBitmap[index], index);
848 else 845 else
849 ASSERT_NOT_REACHED(); 846 ASSERT_NOT_REACHED();
850 #endif 847 #endif
851 } 848 }
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 1912
1916 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) 1913 void GraphicsContext::didDrawTextInRect(const SkRect& textRect)
1917 { 1914 {
1918 if (m_trackTextRegion) { 1915 if (m_trackTextRegion) {
1919 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); 1916 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion");
1920 m_textRegion.join(textRect); 1917 m_textRegion.join(textRect);
1921 } 1918 }
1922 } 1919 }
1923 1920
1924 } 1921 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698