From 2fc6aacde8a249ac30393207217795d8fe623e1f Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Mon, 21 May 2012 17:24:05 +0200 Subject: [PATCH] Bug 756454: User 2D texture for gradient realizations. r=jrmuizel --- gfx/2d/DrawTargetD2D.cpp | 11 ++++++----- gfx/2d/DrawTargetD2D.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gfx/2d/DrawTargetD2D.cpp b/gfx/2d/DrawTargetD2D.cpp index 6fad7b95ec73..5345c001c647 100644 --- a/gfx/2d/DrawTargetD2D.cpp +++ b/gfx/2d/DrawTargetD2D.cpp @@ -2086,10 +2086,10 @@ DrawTargetD2D::CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions) return style; } -TemporaryRef +TemporaryRef DrawTargetD2D::CreateGradientTexture(const GradientStopsD2D *aStops) { - CD3D10_TEXTURE1D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, 4096, 1, 1); + CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, 4096, 1, 1, 1); std::vector rawStops; rawStops.resize(aStops->mStopCollection->GetGradientStopCount()); @@ -2144,9 +2144,10 @@ DrawTargetD2D::CreateGradientTexture(const GradientStopsD2D *aStops) D3D10_SUBRESOURCE_DATA data; data.pSysMem = &textureData.front(); + data.SysMemPitch = 4096 * 4; - RefPtr tex; - mDevice->CreateTexture1D(&desc, &data, byRef(tex)); + RefPtr tex; + mDevice->CreateTexture2D(&desc, &data, byRef(tex)); return tex; } @@ -2328,7 +2329,7 @@ DrawTargetD2D::SetupEffectForRadialGradient(const RadialGradientPattern *aPatter const GradientStopsD2D *stops = static_cast(aPattern->mStops.get()); - RefPtr tex = CreateGradientTexture(stops); + RefPtr tex = CreateGradientTexture(stops); RefPtr srView; mDevice->CreateShaderResourceView(tex, NULL, byRef(srView)); diff --git a/gfx/2d/DrawTargetD2D.h b/gfx/2d/DrawTargetD2D.h index 489b32c55339..e6af340dd183 100644 --- a/gfx/2d/DrawTargetD2D.h +++ b/gfx/2d/DrawTargetD2D.h @@ -177,7 +177,7 @@ private: TemporaryRef CreateBrushForPattern(const Pattern &aPattern, Float aAlpha = 1.0f); - TemporaryRef CreateGradientTexture(const GradientStopsD2D *aStops); + TemporaryRef CreateGradientTexture(const GradientStopsD2D *aStops); TemporaryRef CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, const IntRect &aBounds); // This creates a partially uploaded bitmap for a SourceSurfaceD2D that is