зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1450814 - generic implementation of DrawTarget::Blur using LockBits. r=rhunt
MozReview-Commit-ID: 2jROASoiPQd
This commit is contained in:
Родитель
625d71bd40
Коммит
dc3fc2506c
|
@ -1259,9 +1259,7 @@ public:
|
|||
* Perform an in-place blur operation. This is only supported on data draw
|
||||
* targets.
|
||||
*/
|
||||
virtual void Blur(const AlphaBoxBlur& aBlur) {
|
||||
MOZ_CRASH("GFX: DoBlur");
|
||||
}
|
||||
virtual void Blur(const AlphaBoxBlur& aBlur);
|
||||
|
||||
/**
|
||||
* Create a SourceSurface optimized for use with this DrawTarget from
|
||||
|
|
|
@ -268,5 +268,25 @@ DrawTarget::IntoLuminanceSource(LuminanceType aMaskType, float aOpacity)
|
|||
return destMaskSurface.forget();
|
||||
}
|
||||
|
||||
void
|
||||
DrawTarget::Blur(const AlphaBoxBlur& aBlur)
|
||||
{
|
||||
uint8_t* data;
|
||||
IntSize size;
|
||||
int32_t stride;
|
||||
SurfaceFormat format;
|
||||
if (!LockBits(&data, &size, &stride, &format)) {
|
||||
gfxWarning() << "Cannot perform in-place blur on non-data DrawTarget";
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanity check that the blur size matches the draw target.
|
||||
MOZ_ASSERT(size == aBlur.GetSize());
|
||||
MOZ_ASSERT(stride == aBlur.GetStride());
|
||||
aBlur.Blur(data);
|
||||
|
||||
ReleaseBits(data);
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -2183,25 +2183,6 @@ DrawTargetSkia::PopLayer()
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DrawTargetSkia::Blur(const AlphaBoxBlur& aBlur)
|
||||
{
|
||||
MarkChanged();
|
||||
Flush();
|
||||
|
||||
SkPixmap pixmap;
|
||||
if (!mCanvas->peekPixels(&pixmap)) {
|
||||
gfxWarning() << "Cannot perform in-place blur on non-raster Skia surface";
|
||||
return;
|
||||
}
|
||||
|
||||
// Sanity check that the blur size matches the draw target.
|
||||
MOZ_ASSERT(pixmap.width() == aBlur.GetSize().width);
|
||||
MOZ_ASSERT(pixmap.height() == aBlur.GetSize().height);
|
||||
MOZ_ASSERT(size_t(aBlur.GetStride()) == pixmap.rowBytes());
|
||||
aBlur.Blur(static_cast<uint8_t*>(pixmap.writable_addr()));
|
||||
}
|
||||
|
||||
already_AddRefed<GradientStops>
|
||||
DrawTargetSkia::CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode) const
|
||||
{
|
||||
|
|
|
@ -116,7 +116,6 @@ public:
|
|||
bool aCopyBackground = false,
|
||||
CompositionOp aCompositionOp = CompositionOp::OP_OVER) override;
|
||||
virtual void PopLayer() override;
|
||||
virtual void Blur(const AlphaBoxBlur& aBlur) override;
|
||||
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
const IntSize &aSize,
|
||||
int32_t aStride,
|
||||
|
|
Загрузка…
Ссылка в новой задаче