summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/mac
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-06-03 14:33:32 +0100
committerLeon Clarke <leonclarke@google.com>2010-06-08 12:24:51 +0100
commit5af96e2c7b73ebc627c6894727826a7576d31758 (patch)
treef9d5e6f6175ccd7e3d14de9b290f08937a0d17ba /WebCore/platform/graphics/mac
parent8cc4fcf4f6adcbc0e0aebfc24fbad9a4cddf2cfb (diff)
downloadexternal_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.zip
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.gz
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.bz2
Merge webkit.org at r60469 : Initial merge by git.
Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234
Diffstat (limited to 'WebCore/platform/graphics/mac')
-rw-r--r--WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp48
-rw-r--r--WebCore/platform/graphics/mac/SimpleFontDataMac.mm23
2 files changed, 59 insertions, 12 deletions
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 80c0d03..79a10dd 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -321,15 +321,53 @@ void GraphicsContext3D::reshape(int width, int height)
notImplemented();
}
- if (mustRestoreFBO)
- ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
+ if (m_attrs.antialias) {
+ ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO);
+ if (m_boundFBO == m_multisampleFBO)
+ mustRestoreFBO = false;
+ }
- GLenum clearMask = GL_COLOR_BUFFER_BIT;
- if (m_attrs.depth)
+ // Initialize renderbuffers to 0.
+ GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE, stencilMask = GL_TRUE;
+ GLboolean isScissorEnabled = GL_FALSE;
+ GLboolean isDitherEnabled = GL_FALSE;
+ GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
+ ::glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
+ ::glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ if (m_attrs.depth) {
+ ::glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
+ ::glDepthMask(GL_TRUE);
clearMask |= GL_DEPTH_BUFFER_BIT;
- if (m_attrs.stencil)
+ }
+ if (m_attrs.stencil) {
+ ::glGetBooleanv(GL_STENCIL_WRITEMASK, &stencilMask);
+ ::glStencilMask(GL_TRUE);
clearMask |= GL_STENCIL_BUFFER_BIT;
+ }
+ isScissorEnabled = ::glIsEnabled(GL_SCISSOR_TEST);
+ ::glDisable(GL_SCISSOR_TEST);
+ isDitherEnabled = ::glIsEnabled(GL_DITHER);
+ ::glDisable(GL_DITHER);
+
::glClear(clearMask);
+
+ ::glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
+ if (m_attrs.depth)
+ ::glDepthMask(depthMask);
+ if (m_attrs.stencil)
+ ::glStencilMask(stencilMask);
+ if (isScissorEnabled)
+ ::glEnable(GL_SCISSOR_TEST);
+ else
+ ::glDisable(GL_SCISSOR_TEST);
+ if (isDitherEnabled)
+ ::glEnable(GL_DITHER);
+ else
+ ::glDisable(GL_DITHER);
+
+ if (mustRestoreFBO)
+ ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
+
::glFlush();
}
diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index 7f1a72e..04badbe 100644
--- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -265,14 +265,19 @@ void SimpleFontData::platformInit()
GlyphPage* glyphPageZero = GlyphPageTreeNode::getRootChild(this, 0)->page();
NSGlyph xGlyph = glyphPageZero ? glyphPageZero->glyphDataForCharacter('x').glyph : 0;
if (xGlyph) {
- NSRect xBox = [m_platformData.font() boundingRectForGlyph:xGlyph];
+ CGRect xBox = platformBoundsForGlyph(xGlyph);
// Use the maximum of either width or height because "x" is nearly square
// and web pages that foolishly use this metric for width will be laid out
// poorly if we return an accurate height. Classic case is Times 13 point,
// which has an "x" that is 7x6 pixels.
- m_xHeight = max(NSMaxX(xBox), NSMaxY(xBox));
- } else
- m_xHeight = [m_platformData.font() xHeight];
+ m_xHeight = static_cast<float>(max(CGRectGetMaxX(xBox), CGRectGetMaxY(xBox)));
+ } else {
+#ifndef BUILDING_ON_TIGER
+ m_xHeight = static_cast<float>(CGFontGetXHeight(m_platformData.cgFont())) / m_unitsPerEm;
+#else
+ m_xHeight = m_platformData.font() ? [m_platformData.font() xHeight] : 0;
+#endif
+ }
}
static CFDataRef copyFontTableForTag(FontPlatformData platformData, FourCharCode tableName)
@@ -417,11 +422,15 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
float pointSize = platformData().m_size;
CGFloat scale = pointSize / unitsPerEm();
boundingBox = CGRectApplyAffineTransform(box, CGAffineTransformMakeScale(scale, -scale));
- if (m_syntheticBoldOffset)
- boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset);
#else
- UNUSED_PARAM(glyph);
+ // FIXME: Custom fonts don't have NSFonts, so this function doesn't compute correct bounds for these on Tiger.
+ if (!m_platformData.font())
+ return boundingBox;
+ boundingBox = [m_platformData.font() boundingRectForGlyph:glyph];
#endif
+ if (m_syntheticBoldOffset)
+ boundingBox.setWidth(boundingBox.width() + m_syntheticBoldOffset);
+
return boundingBox;
}