mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Bug 933584 - Implement OptimizeSourceSurface for skia. r=mattwoodrow
This commit is contained in:
parent
f4971d6f32
commit
753a3ffb47
@ -795,9 +795,9 @@ public:
|
||||
SurfaceFormat aFormat) const = 0;
|
||||
|
||||
/*
|
||||
* Create a SourceSurface optimized for use with this DrawTarget from
|
||||
* an arbitrary other SourceSurface. This may return aSourceSurface or some
|
||||
* other existing surface.
|
||||
* Create a SourceSurface optimized for use with this DrawTarget from an
|
||||
* arbitrary SourceSurface type supported by this backend. This may return
|
||||
* aSourceSurface or some other existing surface.
|
||||
*/
|
||||
virtual TemporaryRef<SourceSurface> OptimizeSourceSurface(SourceSurface *aSurface) const = 0;
|
||||
|
||||
|
@ -602,9 +602,9 @@ DrawTargetSkia::Mask(const Pattern &aSource,
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetSkia::CreateSourceSurfaceFromData(unsigned char *aData,
|
||||
const IntSize &aSize,
|
||||
int32_t aStride,
|
||||
SurfaceFormat aFormat) const
|
||||
const IntSize &aSize,
|
||||
int32_t aStride,
|
||||
SurfaceFormat aFormat) const
|
||||
{
|
||||
RefPtr<SourceSurfaceSkia> newSurf = new SourceSurfaceSkia();
|
||||
|
||||
@ -629,7 +629,20 @@ DrawTargetSkia::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor
|
||||
TemporaryRef<SourceSurface>
|
||||
DrawTargetSkia::OptimizeSourceSurface(SourceSurface *aSurface) const
|
||||
{
|
||||
return nullptr;
|
||||
if (aSurface->GetType() == SURFACE_SKIA) {
|
||||
return aSurface;
|
||||
}
|
||||
|
||||
if (aSurface->GetType() != SURFACE_DATA) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
|
||||
RefPtr<SourceSurface> surface = CreateSourceSurfaceFromData(data->GetData(),
|
||||
data->GetSize(),
|
||||
data->Stride(),
|
||||
data->GetFormat());
|
||||
return data.forget();
|
||||
}
|
||||
|
||||
TemporaryRef<SourceSurface>
|
||||
@ -644,13 +657,13 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface,
|
||||
const IntPoint &aDestination)
|
||||
{
|
||||
//TODO: We could just use writePixels() here if the sourceRect is the entire source
|
||||
|
||||
|
||||
if (aSurface->GetType() != SURFACE_SKIA) {
|
||||
return;
|
||||
}
|
||||
|
||||
MarkChanged();
|
||||
|
||||
|
||||
const SkBitmap& bitmap = static_cast<SourceSurfaceSkia*>(aSurface)->GetBitmap();
|
||||
|
||||
mCanvas->save();
|
||||
|
Loading…
x
Reference in New Issue
Block a user