diff options
author | Steve Block <steveblock@google.com> | 2010-07-08 12:51:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-07-09 15:33:40 +0100 |
commit | ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch) | |
tree | bb45155550ec013adc0ad10f4d7d354c6469b022 /WebCore/platform/graphics/win | |
parent | d4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff) | |
download | external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2 |
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebCore/platform/graphics/win')
3 files changed, 33 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp index 7387a14..94df6ae 100644 --- a/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextCairoWin.cpp @@ -84,6 +84,12 @@ GraphicsContext::GraphicsContext(HDC dc, bool hasAlpha) } } +static void setRGBABitmapAlpha(unsigned char* bytes, size_t length, unsigned char level) +{ + for (size_t i = 0; i < length; i += 4) + bytes[i + 3] = level; +} + void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) { if (!mayCreateBitmap || !hdc || !inTransparencyLayer()) { @@ -100,9 +106,16 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo GetObject(bitmap, sizeof(info), &info); ASSERT(info.bmBitsPixel == 32); + // If this context does not support alpha blending, then it may have + // been drawn with GDI functions which always set the alpha channel + // to zero. We need to manually set the bitmap to be fully opaque. + unsigned char* bytes = reinterpret_cast<unsigned char*>(info.bmBits); + if (!supportAlphaBlend) + setRGBABitmapAlpha(bytes, info.bmHeight * info.bmWidthBytes, 255); + // Need to make a cairo_surface_t out of the bitmap's pixel buffer and then draw // it into our context. - cairo_surface_t* image = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, + cairo_surface_t* image = cairo_image_surface_create_for_data(bytes, CAIRO_FORMAT_ARGB32, info.bmWidth, info.bmHeight, @@ -111,9 +124,10 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo // Scale the target surface to the new image size, and flip it // so that when we set the srcImage as the surface it will draw // right-side-up. - cairo_translate(m_data->cr, 0, dstRect.height()); - cairo_scale(m_data->cr, dstRect.width(), -dstRect.height()); - cairo_set_source_surface (m_data->cr, image, dstRect.x(), dstRect.y()); + cairo_save(m_data->cr); + cairo_translate(m_data->cr, dstRect.x(), dstRect.height() + dstRect.y()); + cairo_scale(m_data->cr, 1.0, -1.0); + cairo_set_source_surface(m_data->cr, image, 0, 0); if (m_data->layers.size()) cairo_paint_with_alpha(m_data->cr, m_data->layers.last()); @@ -124,6 +138,7 @@ void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, boo cairo_surface_destroy(image); ::DeleteDC(hdc); ::DeleteObject(bitmap); + cairo_restore(m_data->cr); } void GraphicsContextPlatformPrivate::syncContext(PlatformGraphicsContext* cr) diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp index 2ca1a96..e664f2a 100644 --- a/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp +++ b/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp @@ -28,9 +28,12 @@ #include "IntRect.h" #include "WebCoreInstanceHandle.h" -#include <CoreGraphics/CGColor.h> #include <windows.h> +#if PLATFORM(CG) +#include <CoreGraphics/CGColor.h> +#endif + namespace WebCore { MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow(MediaPlayerPrivateFullscreenClient* client) diff --git a/WebCore/platform/graphics/win/UniscribeController.cpp b/WebCore/platform/graphics/win/UniscribeController.cpp index afea10a..bceec2d 100644 --- a/WebCore/platform/graphics/win/UniscribeController.cpp +++ b/WebCore/platform/graphics/win/UniscribeController.cpp @@ -287,9 +287,16 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S roundingHackCharacters[clusters[k]] = m_currentCharacter + k + item.iCharPos; int boundary = k + m_currentCharacter + item.iCharPos; - if (boundary < m_run.length() && - Font::isRoundingHackCharacter(*(str + k + 1))) - roundingHackWordBoundaries[clusters[k]] = boundary; + if (boundary < m_run.length()) { + // When at the last character in the str, don't look one past the end for a rounding hack character. + // Instead look ahead to the first character of next item, if there is a next one. + if (k + 1 == len) { + if (i + 2 < m_items.size() // Check for at least 2 items remaining. The last item is a terminating item containing no characters. + && Font::isRoundingHackCharacter(*(cp + m_items[i + 1].iCharPos))) + roundingHackWordBoundaries[clusters[k]] = boundary; + } else if (Font::isRoundingHackCharacter(*(str + k + 1))) + roundingHackWordBoundaries[clusters[k]] = boundary; + } } // Populate our glyph buffer with this information. |