1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "TextureWrapperImage.h"
11 using namespace mozilla::gfx
;
13 TextureWrapperImage::TextureWrapperImage(TextureClient
* aClient
,
14 const IntRect
& aPictureRect
)
15 : Image(nullptr, ImageFormat::TEXTURE_WRAPPER
),
16 mPictureRect(aPictureRect
),
17 mTextureClient(aClient
) {}
19 TextureWrapperImage::~TextureWrapperImage() = default;
21 gfx::IntSize
TextureWrapperImage::GetSize() const {
22 return mTextureClient
->GetSize();
25 gfx::IntRect
TextureWrapperImage::GetPictureRect() const {
29 already_AddRefed
<gfx::SourceSurface
> TextureWrapperImage::GetAsSourceSurface() {
30 TextureClientAutoLock
autoLock(mTextureClient
, OpenMode::OPEN_READ
);
31 if (!autoLock
.Succeeded()) {
35 RefPtr
<DrawTarget
> dt
= mTextureClient
->BorrowDrawTarget();
40 return dt
->Snapshot();
43 TextureClient
* TextureWrapperImage::GetTextureClient(
44 KnowsCompositor
* aKnowsCompositor
) {
45 return mTextureClient
;
49 } // namespace mozilla