Skip to content

Commit

Permalink
Bug 1076695 - Don't convert alpha surfaces into RGBA surfaces for Fil…
Browse files Browse the repository at this point in the history
…terNodeTransformSoftware. r=Bas
  • Loading branch information
mstange committed Oct 7, 2014
1 parent 391dd9a commit 4c6fa36
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions gfx/2d/FilterNodeSoftware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
IntRect srcRect = SourceRectForOutputRect(aRect);

RefPtr<DataSourceSurface> input =
GetInputDataSourceSurface(IN_TRANSFORM_IN, srcRect, NEED_COLOR_CHANNELS);
GetInputDataSourceSurface(IN_TRANSFORM_IN, srcRect);

if (!input) {
return nullptr;
Expand All @@ -1168,8 +1168,18 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
return input.forget();
}

RefPtr<DataSourceSurface> surf =
Factory::CreateDataSourceSurface(aRect.Size(), input->GetFormat());

DataSourceSurface::MappedSurface mapping;
surf->Map(DataSourceSurface::MapType::WRITE, &mapping);

RefPtr<DrawTarget> dt =
Factory::CreateDrawTarget(BackendType::CAIRO, aRect.Size(), input->GetFormat());
Factory::CreateDrawTargetForData(BackendType::CAIRO,
mapping.mData,
surf->GetSize(),
mapping.mStride,
surf->GetFormat());
if (!dt) {
return nullptr;
}
Expand All @@ -1178,9 +1188,9 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
dt->SetTransform(transform);
dt->DrawSurface(input, r, r, DrawSurfaceOptions(mFilter));

RefPtr<SourceSurface> result = dt->Snapshot();
RefPtr<DataSourceSurface> resultData = result->GetDataSurface();
return resultData.forget();
dt->Flush();
surf->Unmap();
return surf.forget();
}

void
Expand Down

0 comments on commit 4c6fa36

Please sign in to comment.