Diff
Modified: branches/safari-600.2-branch/Source/WebCore/ChangeLog (175011 => 175012)
--- branches/safari-600.2-branch/Source/WebCore/ChangeLog 2014-10-22 01:47:15 UTC (rev 175011)
+++ branches/safari-600.2-branch/Source/WebCore/ChangeLog 2014-10-22 01:50:23 UTC (rev 175012)
@@ -1,5 +1,42 @@
2014-10-21 Dana Burkart <[email protected]>
+ Merge r174414
+
+ 2014-10-08 Dean Jackson <[email protected]>
+
+ Safari 8 on OSX 10.10 does not run WebGL in Retina HiDPI mode.
+ https://bugs.webkit.org/show_bug.cgi?id=134854
+ <rdar://problem/18465263>
+
+ Reviewed by Tim Horton.
+
+ The NSOpenGLLayer has to have its contentScale property
+ set accordingly when on a retina display. Do this by
+ adding another value to the GraphicsContext3D creation
+ attribute dictionary, representing the device pixel ratio.
+ Then, when we come to draw into the layer, make sure
+ we set our GL viewport to the correct value.
+
+ This is currently untestable because:
+ - we can't just read from the GL buffer as it is always correct
+ - WebGL isn't working in reftests
+ - a layer dump doesn't show the change since it was done in a CALayer subclass.
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::create): Pass the devicePixelRatio into the attribute dictionary.
+ * platform/graphics/GraphicsContext3D.h:
+ (WebCore::GraphicsContext3D::Attributes::Attributes): Add a devicePixelRatio attribute.
+ * platform/graphics/mac/WebGLLayer.h: New property to save us looking up the attributes
+ each frame.
+ * platform/graphics/mac/WebGLLayer.mm:
+ (-[WebGLLayer initWithGraphicsContext3D:]): Store the devicePixelRatio, and set our
+ contents scale appropriately.
+ (-[WebGLLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:]): Draw into
+ a correctly sized backbuffer.
+ (-[WebGLLayer copyImageSnapshotWithColorSpace:]): Generate an image of the correct size.
+
+2014-10-21 Dana Burkart <[email protected]>
+
Merge r173848
2014-09-22 Alexey Proskuryakov <[email protected]>
Modified: branches/safari-600.2-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (175011 => 175012)
--- branches/safari-600.2-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2014-10-22 01:47:15 UTC (rev 175011)
+++ branches/safari-600.2-branch/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2014-10-22 01:50:23 UTC (rev 175012)
@@ -437,6 +437,9 @@
if (frame->settings().forceSoftwareWebGLRendering())
attributes.forceSoftwareRenderer = true;
+ if (page)
+ attributes.devicePixelRatio = page->deviceScaleFactor();
+
if (isPendingPolicyResolution) {
LOG(WebGL, "Create a WebGL context that looks real, but will require a policy resolution if used.");
std::unique_ptr<WebGLRenderingContext> renderingContext(new WebGLRenderingContext(canvas, attributes));
Modified: branches/safari-600.2-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h (175011 => 175012)
--- branches/safari-600.2-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h 2014-10-22 01:47:15 UTC (rev 175011)
+++ branches/safari-600.2-branch/Source/WebCore/platform/graphics/GraphicsContext3D.h 2014-10-22 01:50:23 UTC (rev 175012)
@@ -443,6 +443,7 @@
, preferDiscreteGPU(false)
, multithreaded(false)
, forceSoftwareRenderer(false)
+ , devicePixelRatio(1)
{
}
@@ -457,6 +458,7 @@
bool preferDiscreteGPU;
bool multithreaded;
bool forceSoftwareRenderer;
+ float devicePixelRatio;
};
enum RenderStyle {
Modified: branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.h (175011 => 175012)
--- branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.h 2014-10-22 01:47:15 UTC (rev 175011)
+++ branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.h 2014-10-22 01:50:23 UTC (rev 175012)
@@ -40,6 +40,7 @@
#endif
{
WebCore::GraphicsContext3D* _context;
+ float _devicePixelRatio;
}
@property (nonatomic) WebCore::GraphicsContext3D* context;
Modified: branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm (175011 => 175012)
--- branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm 2014-10-22 01:47:15 UTC (rev 175011)
+++ branches/safari-600.2-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm 2014-10-22 01:50:23 UTC (rev 175012)
@@ -48,6 +48,10 @@
{
_context = context;
self = [super init];
+ _devicePixelRatio = context->getContextAttributes().devicePixelRatio;
+#if !PLATFORM(IOS)
+ self.contentsScale = _devicePixelRatio;
+#endif
return self;
}
@@ -81,7 +85,9 @@
CGLSetCurrentContext(glContext);
CGRect frame = [self frame];
-
+ frame.size.width *= _devicePixelRatio;
+ frame.size.height *= _devicePixelRatio;
+
// draw the FBO into the layer
glViewport(0, 0, frame.size.width, frame.size.height);
glMatrixMode(GL_PROJECTION);
@@ -134,8 +140,8 @@
CGRect layerBounds = CGRectIntegral([self bounds]);
- size_t width = layerBounds.size.width;
- size_t height = layerBounds.size.height;
+ size_t width = layerBounds.size.width * _devicePixelRatio;
+ size_t height = layerBounds.size.height * _devicePixelRatio;
size_t rowBytes = (width * 4 + 15) & ~15;
size_t dataSize = rowBytes * height;