Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Expose texture target value into API
  • Loading branch information
tmeshkova committed Mar 27, 2014
1 parent 22eb14d commit f7d87c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions embedding/embedlite/EmbedLiteView.cpp
Expand Up @@ -410,10 +410,10 @@ EmbedLiteView::GetUniqueID()
}

bool
EmbedLiteView::GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height)
EmbedLiteView::GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* textureTarget)
{
NS_ENSURE_TRUE(mViewImpl, false);
return mViewImpl->GetPendingTexture(aContextWrapper, textureID, width, height);
return mViewImpl->GetPendingTexture(aContextWrapper, textureID, width, height, textureTarget);
}

} // namespace embedlite
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/EmbedLiteView.h
Expand Up @@ -147,7 +147,7 @@ class EmbedLiteView
virtual void SendAsyncMessage(const char16_t* aMessageName, const char16_t* aMessage);

virtual uint32_t GetUniqueID();
virtual bool GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height);
virtual bool GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* textureTarget = 0);

private:
friend class EmbedLiteViewThreadParent;
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/embedhelpers/EmbedLiteViewImplIface.h
Expand Up @@ -56,7 +56,7 @@ class EmbedLiteViewImplIface
virtual void UpdateScrollController() {}
virtual void ViewAPIDestroyed() {}
virtual uint32_t GetUniqueID() { return 0; }
virtual bool GetPendingTexture(mozilla::embedlite::EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height) { return false; }
virtual bool GetPendingTexture(mozilla::embedlite::EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* textureTarget) { return false; }
};

} // namespace embedlite
Expand Down
Expand Up @@ -718,7 +718,7 @@ EmbedLiteViewThreadParent::GetUniqueID()
return mId;
}

bool EmbedLiteViewThreadParent::GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height)
bool EmbedLiteViewThreadParent::GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* aTextureTarget)
{
NS_ENSURE_TRUE(aContextWrapper && textureID && width && height, false);
NS_ENSURE_TRUE(mCompositor, false);
Expand Down Expand Up @@ -747,6 +747,7 @@ bool EmbedLiteViewThreadParent::GetPendingTexture(EmbedLiteRenderTarget* aContex
} else if (sharedSurf->Type() == SharedSurfaceType::GLTextureShare) {
SharedSurface_GLTexture* glTexSurf = SharedSurface_GLTexture::Cast(sharedSurf);
textureHandle = glTexSurf->ConsTexture(consumerContext);
textureTarget = glTexSurf->ConsTextureTarget();
NS_ASSERTION(textureHandle, "Failed to get texture handle, fallback to pixels?");
} else if (sharedSurf->Type() == SharedSurfaceType::Basic) {
toUpload = SharedSurface_Basic::Cast(sharedSurf)->GetData();
Expand All @@ -765,6 +766,7 @@ bool EmbedLiteViewThreadParent::GetPendingTexture(EmbedLiteRenderTarget* aContex
mUploadTexture,
true);
textureHandle = mUploadTexture;
textureTarget = LOCAL_GL_TEXTURE_2D;
} else if (textureHandle) {
if (consumerContext) {
MOZ_ASSERT(consumerContext);
Expand All @@ -779,6 +781,9 @@ bool EmbedLiteViewThreadParent::GetPendingTexture(EmbedLiteRenderTarget* aContex
*width = sharedSurf->Size().width;
*height = sharedSurf->Size().height;
*textureID = textureHandle;
if (aTextureTarget) {
*aTextureTarget = textureTarget;
}
return true;
}

Expand Down
Expand Up @@ -59,7 +59,7 @@ class EmbedLiteViewThreadParent : public PEmbedLiteViewParent,
virtual void AddMessageListeners(const nsTArray<nsString>&);
virtual void RemoveMessageListeners(const nsTArray<nsString>&);

virtual bool GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height);
virtual bool GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* textureTarget);

EmbedLiteCompositorParent* GetCompositor() { return mCompositor.get(); };

Expand Down

0 comments on commit f7d87c2

Please sign in to comment.