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

Unified Diff: third_party/WebKit/WebCore/platform/graphics/chromium/FontChromiumWin.cpp

Issue 18339: Attempt at getting GDI text to render when drawn using canvas. I added... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
===================================================================
--- third_party/WebKit/WebCore/platform/graphics/chromium/FontChromiumWin.cpp (revision 8367)
+++ third_party/WebKit/WebCore/platform/graphics/chromium/FontChromiumWin.cpp (working copy)
@@ -174,6 +174,19 @@
{
PlatformGraphicsContext* context = graphicsContext->platformContext();
+ bool canUseGDI = windowsCanHandleTextDrawing(graphicsContext);
+ bool createdLayer = false;
+
+ if (canUseGDI && context->isDrawingToImageBuffer()) {
+ // We're drawing to an image buffer and about to render text with GDI.
+ // We need to start a layer here, otherwise the alpha values rendered
+ // by GDI are never correctly updated.
+ // NOTE: this doesn't handle clear type well and should be removed when
+ // we have better text handling code.
+ graphicsContext->beginTransparencyLayer(1.0);
+ createdLayer = true;
+ }
+
// Max buffer length passed to the underlying windows API.
const int kMaxBufferLength = 1024;
// Default size for the buffer. It should be enough for most of cases.
@@ -205,8 +218,6 @@
int x = static_cast<int>(point.x());
int lineTop = static_cast<int>(point.y()) - font->ascent();
- bool canUseGDI = windowsCanHandleTextDrawing(graphicsContext);
-
// We draw the glyphs in chunks to avoid having to do a heap allocation for
// the arrays of characters and advances. Since ExtTextOut is the
// lowest-level text output function on Windows, there should be little
@@ -252,6 +263,8 @@
}
SelectObject(hdc, oldFont);
+ if (createdLayer)
+ graphicsContext->endTransparencyLayer();
context->canvas()->endPlatformPaint();
}
« no previous file with comments | « no previous file | third_party/WebKit/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698