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

Unified Diff: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp

Issue 26541008: Web setting for canvas2d msaa (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: working? Created 7 years, 2 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
Index: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
index 1532d4f9b687e8b48257598849037d27c829ba74..4b6b34ea3e4b9c64aa2b97bd1a36d150c1ba8682 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.cpp
@@ -59,7 +59,7 @@ Canvas2DLayerBridgePtr& Canvas2DLayerBridgePtr::operator=(const PassRefPtr<Canva
return *this;
}
-static SkSurface* createSurface(GraphicsContext3D* context3D, const IntSize& size)
+static SkSurface* createSurface(GraphicsContext3D* context3D, const IntSize& size, int msaaSampleCount)
{
ASSERT(!context3D->webContext()->isContextLost());
GrContext* gr = context3D->grContext();
@@ -71,13 +71,13 @@ static SkSurface* createSurface(GraphicsContext3D* context3D, const IntSize& siz
info.fHeight = size.height();
info.fColorType = SkImage::kPMColor_ColorType;
info.fAlphaType = kPremul_SkAlphaType;
- return SkSurface::NewRenderTarget(gr, info);
+ return SkSurface::NewRenderTarget(gr, info, msaaSampleCount);
}
-PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(PassRefPtr<GraphicsContext3D> context, const IntSize& size, OpacityMode opacityMode)
+PassRefPtr<Canvas2DLayerBridge> Canvas2DLayerBridge::create(PassRefPtr<GraphicsContext3D> context, const IntSize& size, OpacityMode opacityMode, int msaaSampleCount)
{
TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation");
- SkAutoTUnref<SkSurface> surface(createSurface(context.get(), size));
+ SkAutoTUnref<SkSurface> surface(createSurface(context.get(), size, msaaSampleCount));
if (!surface.get()) {
return PassRefPtr<Canvas2DLayerBridge>();
}
@@ -257,7 +257,8 @@ bool Canvas2DLayerBridge::isValid()
} else {
m_context = sharedContext;
IntSize size(m_canvas->getTopDevice()->width(), m_canvas->getTopDevice()->height());
- SkAutoTUnref<SkSurface> surface(createSurface(m_context.get(), size));
+ int msaaSampleCount = m_canvas->getTopDevice()->accessRenderTarget()->desc().fSampleCnt;
+ SkAutoTUnref<SkSurface> surface(createSurface(m_context.get(), size, msaaSampleCount));
if (surface.get()) {
m_canvas->setSurface(surface.get());
m_surfaceIsValid = true;

Powered by Google App Engine
This is Rietveld 408576698