2017-01-10 12:17:30 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebRenderAPI.h"
|
2017-01-17 03:21:52 +03:00
|
|
|
#include "mozilla/webrender/RendererOGL.h"
|
2017-01-10 12:17:30 +03:00
|
|
|
#include "mozilla/layers/CompositorThread.h"
|
|
|
|
#include "mozilla/widget/CompositorWidget.h"
|
2017-01-11 15:51:27 +03:00
|
|
|
#include "mozilla/widget/CompositorWidget.h"
|
|
|
|
#include "mozilla/layers/SynchronousTask.h"
|
2017-01-10 12:17:30 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
2017-01-17 03:22:09 +03:00
|
|
|
namespace wr {
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-17 23:13:41 +03:00
|
|
|
Maybe<WrImageFormat>
|
2017-01-17 17:53:57 +03:00
|
|
|
SurfaceFormatToWrImageFormat(gfx::SurfaceFormat aFormat) {
|
2017-01-16 17:22:47 +03:00
|
|
|
switch (aFormat) {
|
2017-01-17 22:48:00 +03:00
|
|
|
case gfx::SurfaceFormat::B8G8R8X8:
|
|
|
|
// TODO: WebRender will have a BGRA + opaque flag for this but does not
|
|
|
|
// have it yet (cf. issue #732).
|
2017-01-16 17:22:47 +03:00
|
|
|
case gfx::SurfaceFormat::B8G8R8A8:
|
2017-01-17 17:53:57 +03:00
|
|
|
return Some(WrImageFormat::RGBA8);
|
2017-01-16 17:22:47 +03:00
|
|
|
case gfx::SurfaceFormat::B8G8R8:
|
2017-01-17 17:53:57 +03:00
|
|
|
return Some(WrImageFormat::RGB8);
|
2017-01-16 17:22:47 +03:00
|
|
|
case gfx::SurfaceFormat::A8:
|
2017-01-17 17:53:57 +03:00
|
|
|
return Some(WrImageFormat::A8);
|
2017-01-16 17:22:47 +03:00
|
|
|
case gfx::SurfaceFormat::UNKNOWN:
|
2017-01-17 17:53:57 +03:00
|
|
|
return Some(WrImageFormat::Invalid);
|
2017-01-16 17:22:47 +03:00
|
|
|
default:
|
|
|
|
return Nothing();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-10 12:17:30 +03:00
|
|
|
class NewRenderer : public RendererEvent
|
|
|
|
{
|
|
|
|
public:
|
2017-01-17 03:22:09 +03:00
|
|
|
NewRenderer(WrAPI** aApi, layers::CompositorBridgeParentBase* aBridge,
|
2017-01-18 22:50:00 +03:00
|
|
|
GLint* aMaxTextureSize,
|
2017-01-11 15:51:27 +03:00
|
|
|
RefPtr<widget::CompositorWidget>&& aWidget,
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::SynchronousTask* aTask,
|
2017-01-11 15:51:27 +03:00
|
|
|
bool aEnableProfiler)
|
2017-01-25 00:06:17 +03:00
|
|
|
: mWrApi(aApi)
|
|
|
|
, mMaxTextureSize(aMaxTextureSize)
|
|
|
|
, mBridge(aBridge)
|
|
|
|
, mCompositorWidget(Move(aWidget))
|
|
|
|
, mTask(aTask)
|
|
|
|
, mEnableProfiler(aEnableProfiler)
|
2017-01-10 12:17:30 +03:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(NewRenderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
~NewRenderer()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(NewRenderer);
|
|
|
|
}
|
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override
|
2017-01-10 12:17:30 +03:00
|
|
|
{
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::AutoCompleteTask complete(mTask);
|
2017-01-11 15:51:27 +03:00
|
|
|
|
|
|
|
RefPtr<gl::GLContext> gl = gl::GLContextProvider::CreateForCompositorWidget(mCompositorWidget, true);
|
|
|
|
if (!gl || !gl->MakeCurrent()) {
|
|
|
|
return;
|
2017-01-10 12:17:30 +03:00
|
|
|
}
|
2017-01-11 15:51:27 +03:00
|
|
|
|
2017-01-18 22:50:00 +03:00
|
|
|
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, mMaxTextureSize);
|
|
|
|
|
2017-01-25 00:20:54 +03:00
|
|
|
wr_gl_init(gl.get());
|
2017-01-11 15:51:27 +03:00
|
|
|
|
|
|
|
WrRenderer* wrRenderer = nullptr;
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_window_new(aWindowId.mHandle, this->mEnableProfiler, mWrApi, &wrRenderer);
|
2017-01-11 15:51:27 +03:00
|
|
|
MOZ_ASSERT(wrRenderer);
|
|
|
|
|
|
|
|
RefPtr<RenderThread> thread = &aRenderThread;
|
|
|
|
auto renderer = MakeUnique<RendererOGL>(Move(thread),
|
|
|
|
Move(gl),
|
|
|
|
Move(mCompositorWidget),
|
|
|
|
aWindowId,
|
|
|
|
wrRenderer,
|
|
|
|
mBridge);
|
|
|
|
|
|
|
|
aRenderThread.AddRenderer(aWindowId, Move(renderer));
|
2017-01-10 12:17:30 +03:00
|
|
|
}
|
|
|
|
|
2017-01-25 00:20:54 +03:00
|
|
|
private:
|
2017-01-17 22:48:00 +03:00
|
|
|
WrAPI** mWrApi;
|
2017-01-18 22:50:00 +03:00
|
|
|
GLint* mMaxTextureSize;
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::CompositorBridgeParentBase* mBridge;
|
2017-01-10 12:17:30 +03:00
|
|
|
RefPtr<widget::CompositorWidget> mCompositorWidget;
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::SynchronousTask* mTask;
|
2017-01-11 15:51:27 +03:00
|
|
|
bool mEnableProfiler;
|
2017-01-10 12:17:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class RemoveRenderer : public RendererEvent
|
|
|
|
{
|
|
|
|
public:
|
2017-01-17 03:22:09 +03:00
|
|
|
explicit RemoveRenderer(layers::SynchronousTask* aTask)
|
2017-01-25 00:06:17 +03:00
|
|
|
: mTask(aTask)
|
2017-01-11 15:51:27 +03:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(RemoveRenderer);
|
|
|
|
}
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-11 15:51:27 +03:00
|
|
|
~RemoveRenderer()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(RemoveRenderer);
|
|
|
|
}
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override
|
2017-01-10 12:17:30 +03:00
|
|
|
{
|
|
|
|
aRenderThread.RemoveRenderer(aWindowId);
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::AutoCompleteTask complete(mTask);
|
2017-01-10 12:17:30 +03:00
|
|
|
}
|
2017-01-11 15:51:27 +03:00
|
|
|
|
2017-01-25 00:20:54 +03:00
|
|
|
private:
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::SynchronousTask* mTask;
|
2017-01-10 12:17:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//static
|
|
|
|
already_AddRefed<WebRenderAPI>
|
|
|
|
WebRenderAPI::Create(bool aEnableProfiler,
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::CompositorBridgeParentBase* aBridge,
|
2017-01-10 12:17:30 +03:00
|
|
|
RefPtr<widget::CompositorWidget>&& aWidget)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aBridge);
|
|
|
|
MOZ_ASSERT(aWidget);
|
|
|
|
|
|
|
|
static uint64_t sNextId = 1;
|
2017-01-17 03:22:09 +03:00
|
|
|
WindowId id(sNextId++);
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-11 15:51:27 +03:00
|
|
|
WrAPI* wrApi = nullptr;
|
2017-01-18 22:50:00 +03:00
|
|
|
GLint maxTextureSize = 0;
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-11 15:51:27 +03:00
|
|
|
// Dispatch a synchronous task because the WrApi object needs to be created
|
|
|
|
// on the render thread. If need be we could delay waiting on this task until
|
|
|
|
// the next time we need to access the WrApi object.
|
2017-01-17 03:22:09 +03:00
|
|
|
layers::SynchronousTask task("Create Renderer");
|
2017-01-18 22:50:00 +03:00
|
|
|
auto event = MakeUnique<NewRenderer>(&wrApi, aBridge, &maxTextureSize,
|
|
|
|
Move(aWidget), &task, aEnableProfiler);
|
2017-01-11 15:51:27 +03:00
|
|
|
RenderThread::Get()->RunEvent(id, Move(event));
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-11 15:51:27 +03:00
|
|
|
task.Wait();
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-11 15:51:27 +03:00
|
|
|
if (!wrApi) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-18 22:50:00 +03:00
|
|
|
return RefPtr<WebRenderAPI>(new WebRenderAPI(wrApi, id, maxTextureSize)).forget();
|
2017-01-10 12:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WebRenderAPI::~WebRenderAPI()
|
|
|
|
{
|
2017-01-17 22:46:31 +03:00
|
|
|
layers::SynchronousTask task("Destroy WebRenderAPI");
|
|
|
|
auto event = MakeUnique<RemoveRenderer>(&task);
|
|
|
|
RunOnRenderThread(Move(event));
|
|
|
|
task.Wait();
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_delete(mWrApi);
|
2017-01-10 12:17:30 +03:00
|
|
|
}
|
|
|
|
|
2017-01-16 17:22:47 +03:00
|
|
|
void
|
|
|
|
WebRenderAPI::SetRootDisplayList(gfx::Color aBgColor,
|
2017-01-17 03:22:09 +03:00
|
|
|
Epoch aEpoch,
|
2017-01-16 17:22:47 +03:00
|
|
|
LayerSize aViewportSize,
|
|
|
|
DisplayListBuilder& aBuilder)
|
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_set_root_display_list(mWrApi, aBuilder.mWrState,
|
2017-01-16 17:22:47 +03:00
|
|
|
aEpoch.mHandle,
|
|
|
|
aViewportSize.width, aViewportSize.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-25 07:29:34 +03:00
|
|
|
WebRenderAPI::Readback(gfx::IntSize size,
|
|
|
|
uint8_t *buffer,
|
|
|
|
uint32_t buffer_size)
|
|
|
|
{
|
|
|
|
class Readback : public RendererEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Readback(layers::SynchronousTask* aTask,
|
|
|
|
gfx::IntSize aSize, uint8_t *aBuffer, uint32_t aBufferSize)
|
|
|
|
: mTask(aTask)
|
|
|
|
, mSize(aSize)
|
|
|
|
, mBuffer(aBuffer)
|
|
|
|
, mBufferSize(aBufferSize)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(Readback);
|
|
|
|
}
|
|
|
|
|
|
|
|
~Readback()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(Readback);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override
|
|
|
|
{
|
|
|
|
aRenderThread.UpdateAndRender(aWindowId);
|
|
|
|
wr_readback_into_buffer(mSize.width, mSize.height, mBuffer, mBufferSize);
|
|
|
|
layers::AutoCompleteTask complete(mTask);
|
|
|
|
}
|
|
|
|
|
|
|
|
layers::SynchronousTask* mTask;
|
|
|
|
gfx::IntSize mSize;
|
|
|
|
uint8_t *mBuffer;
|
|
|
|
uint32_t mBufferSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
layers::SynchronousTask task("Readback");
|
|
|
|
auto event = MakeUnique<Readback>(&task, size, buffer, buffer_size);
|
|
|
|
RunOnRenderThread(Move(event));
|
|
|
|
|
|
|
|
task.Wait();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 03:22:09 +03:00
|
|
|
WebRenderAPI::SetRootPipeline(PipelineId aPipeline)
|
2017-01-16 17:22:47 +03:00
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_set_root_pipeline(mWrApi, aPipeline.mHandle);
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
ImageKey
|
2017-01-16 17:22:47 +03:00
|
|
|
WebRenderAPI::AddImageBuffer(gfx::IntSize aSize,
|
|
|
|
uint32_t aStride,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
Range<uint8_t> aBytes)
|
|
|
|
{
|
2017-01-17 17:53:57 +03:00
|
|
|
auto format = SurfaceFormatToWrImageFormat(aFormat).value();
|
2017-01-17 22:48:00 +03:00
|
|
|
return ImageKey(wr_api_add_image(mWrApi,
|
|
|
|
aSize.width, aSize.height,
|
|
|
|
aStride, format,
|
|
|
|
&aBytes[0], aBytes.length()));
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
ImageKey
|
2017-01-16 17:22:47 +03:00
|
|
|
WebRenderAPI::AddExternalImageHandle(gfx::IntSize aSize,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
uint64_t aHandle)
|
|
|
|
{
|
2017-01-17 17:53:57 +03:00
|
|
|
auto format = SurfaceFormatToWrImageFormat(aFormat).value();
|
2017-01-17 22:48:00 +03:00
|
|
|
return ImageKey(wr_api_add_external_image_texture(mWrApi,
|
|
|
|
aSize.width, aSize.height, format,
|
|
|
|
aHandle));
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 03:22:09 +03:00
|
|
|
WebRenderAPI::UpdateImageBuffer(ImageKey aKey,
|
2017-01-16 17:22:47 +03:00
|
|
|
gfx::IntSize aSize,
|
|
|
|
gfx::SurfaceFormat aFormat,
|
|
|
|
Range<uint8_t> aBytes)
|
|
|
|
{
|
2017-01-17 17:53:57 +03:00
|
|
|
auto format = SurfaceFormatToWrImageFormat(aFormat).value();
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_update_image(mWrApi,
|
2017-01-16 17:22:47 +03:00
|
|
|
aKey.mHandle,
|
|
|
|
aSize.width, aSize.height, format,
|
|
|
|
&aBytes[0], aBytes.length());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 03:22:09 +03:00
|
|
|
WebRenderAPI::DeleteImage(ImageKey aKey)
|
2017-01-16 17:22:47 +03:00
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_delete_image(mWrApi, aKey.mHandle);
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
wr::FontKey
|
2017-01-16 17:22:47 +03:00
|
|
|
WebRenderAPI::AddRawFont(Range<uint8_t> aBytes)
|
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
return wr::FontKey(wr_api_add_raw_font(mWrApi, &aBytes[0], aBytes.length()));
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 03:22:09 +03:00
|
|
|
WebRenderAPI::DeleteFont(wr::FontKey aKey)
|
2017-01-16 17:22:47 +03:00
|
|
|
{
|
|
|
|
printf("XXX - WebRender does not seem to implement deleting a font! Leaking it...\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
class EnableProfiler : public RendererEvent
|
|
|
|
{
|
|
|
|
public:
|
2017-01-25 00:06:17 +03:00
|
|
|
explicit EnableProfiler(bool aEnabled)
|
|
|
|
: mEnabled(aEnabled)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(EnableProfiler);
|
|
|
|
}
|
|
|
|
|
|
|
|
~EnableProfiler()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(EnableProfiler);
|
|
|
|
}
|
2017-01-16 17:22:47 +03:00
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
virtual void Run(RenderThread& aRenderThread, WindowId aWindowId) override
|
2017-01-16 17:22:47 +03:00
|
|
|
{
|
|
|
|
auto renderer = aRenderThread.GetRenderer(aWindowId);
|
|
|
|
if (renderer) {
|
|
|
|
renderer->SetProfilerEnabled(mEnabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-25 00:20:54 +03:00
|
|
|
private:
|
2017-01-16 17:22:47 +03:00
|
|
|
bool mEnabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
WebRenderAPI::SetProfilerEnabled(bool aEnabled)
|
|
|
|
{
|
|
|
|
auto event = MakeUnique<EnableProfiler>(aEnabled);
|
2017-01-17 22:46:31 +03:00
|
|
|
RunOnRenderThread(Move(event));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent>&& aEvent)
|
|
|
|
{
|
|
|
|
auto event = reinterpret_cast<uintptr_t>(aEvent.release());
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_api_send_external_event(mWrApi, event);
|
2017-01-16 17:22:47 +03:00
|
|
|
}
|
|
|
|
|
2017-01-17 03:22:09 +03:00
|
|
|
DisplayListBuilder::DisplayListBuilder(const LayerIntSize& aSize, PipelineId aId)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(DisplayListBuilder);
|
2017-01-17 17:32:25 +03:00
|
|
|
mWrState = wr_state_new(aSize.width, aSize.height, aId.mHandle);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
DisplayListBuilder::~DisplayListBuilder()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(DisplayListBuilder);
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_state_delete(mWrState);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisplayListBuilder::Begin(const LayerIntSize& aSize)
|
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_begin(mWrState, aSize.width, aSize.height);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 03:22:09 +03:00
|
|
|
DisplayListBuilder::End(WebRenderAPI& aApi, Epoch aEpoch)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_dp_end(mWrState, aApi.mWrApi, aEpoch.mHandle);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushStackingContext(const WrRect& aBounds,
|
|
|
|
const WrRect& aOverflow,
|
2017-01-17 17:53:57 +03:00
|
|
|
const WrImageMask* aMask,
|
2017-01-20 02:57:18 +03:00
|
|
|
const gfx::Matrix4x4& aTransform,
|
|
|
|
const WrMixBlendMode& aMixBlendMode)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_push_stacking_context(mWrState, aBounds, aOverflow, aMask,
|
2017-01-20 02:57:18 +03:00
|
|
|
&aTransform.components[0], aMixBlendMode);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisplayListBuilder::PopStackingContext()
|
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_pop_stacking_context(mWrState);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushRect(const WrRect& aBounds,
|
|
|
|
const WrRect& aClip,
|
2017-01-13 13:25:07 +03:00
|
|
|
const gfx::Color& aColor)
|
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_push_rect(mWrState, aBounds, aClip,
|
2017-01-13 13:25:07 +03:00
|
|
|
aColor.r, aColor.g, aColor.b, aColor.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushImage(const WrRect& aBounds,
|
|
|
|
const WrRect& aClip,
|
2017-01-17 17:53:57 +03:00
|
|
|
const WrImageMask* aMask,
|
|
|
|
const WrTextureFilter aFilter,
|
2017-01-17 22:48:00 +03:00
|
|
|
wr::ImageKey aImage)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
2017-01-17 22:48:00 +03:00
|
|
|
wr_dp_push_image(mWrState, aBounds, aClip, aMask, aFilter, aImage.mHandle);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushIFrame(const WrRect& aBounds,
|
|
|
|
const WrRect& aClip,
|
2017-01-17 03:22:09 +03:00
|
|
|
PipelineId aPipeline)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_push_iframe(mWrState, aBounds, aClip, aPipeline.mHandle);
|
2017-01-13 13:25:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushBorder(const WrRect& aBounds,
|
|
|
|
const WrRect& aClip,
|
2017-01-17 17:53:57 +03:00
|
|
|
const WrBorderSide& aTop,
|
|
|
|
const WrBorderSide& aRight,
|
|
|
|
const WrBorderSide& aBottom,
|
|
|
|
const WrBorderSide& aLeft,
|
2017-01-17 17:32:20 +03:00
|
|
|
const WrLayoutSize& aTopLeftRadius,
|
|
|
|
const WrLayoutSize& aTopRightRadius,
|
|
|
|
const WrLayoutSize& aBottomLeftRadius,
|
|
|
|
const WrLayoutSize& aBottomRightRadius)
|
2017-01-13 13:25:07 +03:00
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_push_border(mWrState, aBounds, aClip,
|
2017-01-13 13:25:07 +03:00
|
|
|
aTop, aRight, aBottom, aLeft,
|
|
|
|
aTopLeftRadius, aTopRightRadius,
|
|
|
|
aBottomLeftRadius, aBottomRightRadius);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-17 17:32:16 +03:00
|
|
|
DisplayListBuilder::PushText(const WrRect& aBounds,
|
|
|
|
const WrRect& aClip,
|
2017-01-13 13:25:07 +03:00
|
|
|
const gfx::Color& aColor,
|
2017-01-17 03:22:09 +03:00
|
|
|
wr::FontKey aFontKey,
|
2017-01-24 16:44:23 +03:00
|
|
|
Range<const WrGlyphInstance> aGlyphBuffer,
|
2017-01-13 13:25:07 +03:00
|
|
|
float aGlyphSize)
|
|
|
|
{
|
2017-01-17 17:32:25 +03:00
|
|
|
wr_dp_push_text(mWrState, aBounds, aClip,
|
2017-01-17 17:44:07 +03:00
|
|
|
ToWrColor(aColor),
|
2017-01-13 13:25:07 +03:00
|
|
|
aFontKey.mHandle,
|
|
|
|
&aGlyphBuffer[0], aGlyphBuffer.length(),
|
|
|
|
aGlyphSize);
|
|
|
|
}
|
|
|
|
|
2017-01-25 00:06:17 +03:00
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|