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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/CompositorHUDFontAtlas.cpp

Issue 10873100: Merge 125961 - [chromium] Fix random noise around text in FPS HUD. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 fontHeight = 14; 58 fontHeight = 14;
59 59
60 OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(ATLAS_SIZE, ATLA S_SIZE, false /* opaque */)); 60 OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(ATLAS_SIZE, ATLA S_SIZE, false /* opaque */));
61 61
62 PlatformContextSkia platformContext(canvas.get()); 62 PlatformContextSkia platformContext(canvas.get());
63 platformContext.setDrawingToImageBuffer(true); 63 platformContext.setDrawingToImageBuffer(true);
64 GraphicsContext atlasContext(&platformContext); 64 GraphicsContext atlasContext(&platformContext);
65 65
66 // Clear the entire texture atlas to transparent before drawing fonts. 66 // Clear the entire texture atlas to transparent before drawing fonts.
67 atlasContext.setFillColor(Color(0, 0, 0, 0), ColorSpaceDeviceRGB); 67 atlasContext.setFillColor(Color(0, 0, 0, 0), ColorSpaceDeviceRGB);
68 atlasContext.fillRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE)); 68 atlasContext.clearRect(FloatRect(0, 0, ATLAS_SIZE, ATLAS_SIZE));
69 69
70 // FIXME: monospace font does not work as expected. 70 // FIXME: monospace font does not work as expected.
71 FontDescription fontDescription; 71 FontDescription fontDescription;
72 fontDescription.setGenericFamily(FontDescription::MonospaceFamily); 72 fontDescription.setGenericFamily(FontDescription::MonospaceFamily);
73 fontDescription.setComputedSize(fontHeight); 73 fontDescription.setComputedSize(fontHeight);
74 74
75 FontCachePurgePreventer fontCachePurgePreventer; 75 FontCachePurgePreventer fontCachePurgePreventer;
76 76
77 int textHeight = fontDescription.computedPixelSize(); 77 int textHeight = fontDescription.computedPixelSize();
78 IntPoint position(0, textHeight); 78 IntPoint position(0, textHeight);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 position.setX(position.x() + textWidth); 122 position.setX(position.x() + textWidth);
123 } 123 }
124 124
125 SkBitmap copy; 125 SkBitmap copy;
126 const SkBitmap& source = canvas->getDevice()->accessBitmap(false); 126 const SkBitmap& source = canvas->getDevice()->accessBitmap(false);
127 source.copyTo(&copy, source.config()); 127 source.copyTo(&copy, source.config());
128 return copy; 128 return copy;
129 } 129 }
130 130
131 } // namespace WebCore 131 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698