Bug 1366502 - Add GetWRImageKeys() and PushExternalImage() in textureHost. r=sotaro

These 2 functions are used for WR.
The GetWRImageKeys() will return the proper image keys according to the textureHost format.
The PushExternalImage() will put all necessary WR commands into DisplayListBuilder for the textureHost rendering.

MozReview-Commit-ID: FwCDxwsCMMy
This commit is contained in:
JerryShih 2017-06-06 19:18:39 +08:00
parent dc5be30b45
commit 77ae26621d

View File

@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_TEXTUREHOST_H
#define MOZILLA_GFX_TEXTUREHOST_H
#include <functional>
#include <stddef.h> // for size_t
#include <stdint.h> // for uint64_t, uint32_t, uint8_t
#include "gfxTypes.h"
@ -38,6 +39,7 @@ class Shmem;
} // namespace ipc
namespace wr {
class DisplayListBuilder;
class WebRenderAPI;
}
@ -596,6 +598,18 @@ public:
virtual MacIOSurfaceTextureHostOGL* AsMacIOSurfaceTextureHost() { return nullptr; }
virtual WebRenderTextureHost* AsWebRenderTextureHost() { return nullptr; }
// Create all necessary image keys for this textureHost rendering.
// @param aImageKeys - [out] The set of ImageKeys used for this textureHost
// composing.
// @param aImageKeyAllocator - [in] The function which is used for creating
// the new ImageKey.
virtual void GetWRImageKeys(nsTArray<wr::ImageKey>& aImageKeys,
const std::function<wr::ImageKey()>& aImageKeyAllocator)
{
MOZ_ASSERT(aImageKeys.IsEmpty());
MOZ_ASSERT_UNREACHABLE("No GetWRImageKeys() implementation for this TextureHost type.");
}
// Add all necessary textureHost informations to WebrenderAPI. Then, WR could
// use these informations to compose this textureHost.
virtual void AddWRImage(wr::WebRenderAPI* aAPI,
@ -605,6 +619,16 @@ public:
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this TextureHost type.");
}
// Put all necessary WR commands into DisplayListBuilder for this textureHost rendering.
virtual void PushExternalImage(wr::DisplayListBuilder& aBuilder,
const WrRect& aBounds,
const WrClipRegionToken aClip,
wr::ImageRendering aFilter,
Range<const wr::ImageKey>& aKeys)
{
MOZ_ASSERT_UNREACHABLE("No PushExternalImage() implementation for this TextureHost type.");
}
protected:
void ReadUnlock();