Skip to content

Commit

Permalink
Fixed SW rendering with embedlite
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Jan 14, 2014
1 parent 868dcb0 commit 3947b3e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
Expand Up @@ -46,6 +46,7 @@ EmbedLiteAppThreadParent::RecvInitialized()
mApp->SetBoolPref("layers.acceleration.disabled", !accel);
mApp->SetBoolPref("layers.acceleration.force-enabled", accel);
mApp->SetBoolPref("layers.async-video.enabled", accel);
mApp->SetBoolPref("layers.offmainthreadcomposition.force-basic", !accel);
return true;
}

Expand Down
5 changes: 2 additions & 3 deletions embedding/embedlite/embedthread/EmbedLiteCompositorParent.cpp
Expand Up @@ -79,7 +79,7 @@ EmbedLiteCompositorParent::IsGLBackend()
return EmbedLiteApp::GetInstance()->IsAccelerated();
}

bool EmbedLiteCompositorParent::RenderToContext(gfxContext* aContext)
bool EmbedLiteCompositorParent::RenderToContext(gfx::DrawTarget* aTarget)
{
LOGF();
const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(RootLayerTreeId());
Expand All @@ -89,8 +89,7 @@ bool EmbedLiteCompositorParent::RenderToContext(gfxContext* aContext)
// Nothing to paint yet, just return silently
return false;
}
#warning "Switch me to gfx::DrawTarget"
//ComposeToTarget(aContext);
ComposeToTarget(aTarget);
return true;
}

Expand Down
Expand Up @@ -29,7 +29,7 @@ class EmbedLiteCompositorParent : public mozilla::layers::CompositorParent
uint32_t id);
virtual ~EmbedLiteCompositorParent();

bool RenderToContext(gfxContext* aContext);
bool RenderToContext(gfx::DrawTarget* aTarget);
bool RenderGL();
void SetSurfaceSize(int width, int height);
void SetWorldTransform(gfxMatrix);
Expand Down
16 changes: 7 additions & 9 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadParent.cpp
Expand Up @@ -434,18 +434,18 @@ EmbedLiteViewThreadParent::RecvSyncMessage(const nsString& aMessage,
return true;
}

static inline gfxImageFormat
static inline SurfaceFormat
_depth_to_gfxformat(int depth)
{
switch (depth) {
case 32:
return gfxImageFormatARGB32;
return SurfaceFormat::FORMAT_R8G8B8A8;
case 24:
return gfxImageFormatRGB24;
return SurfaceFormat::FORMAT_R8G8B8X8;
case 16:
return gfxImageFormatRGB16_565;
return SurfaceFormat::FORMAT_R5G6B5;
default:
return gfxImageFormatUnknown;
return SurfaceFormat::FORMAT_UNKNOWN;
}
}

Expand All @@ -454,11 +454,9 @@ EmbedLiteViewThreadParent::RenderToImage(unsigned char* aData, int imgW, int img
{
LOGF("d:%p, sz[%i,%i], stride:%i, depth:%i", aData, imgW, imgH, stride, depth);
if (mCompositor) {
nsRefPtr<gfxImageSurface> source =
new gfxImageSurface(aData, gfxIntSize(imgW, imgH), stride, _depth_to_gfxformat(depth));
RefPtr<DrawTarget> target = gfxPlatform::GetPlatform()->CreateDrawTargetForData(aData, IntSize(imgW, imgH), stride, _depth_to_gfxformat(depth));
{
nsRefPtr<gfxContext> context = new gfxContext(source);
return mCompositor->RenderToContext(context);
return mCompositor->RenderToContext(target);
}
}
return false;
Expand Down

0 comments on commit 3947b3e

Please sign in to comment.