Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/TextureWrapperImage.cpp
Line
Count
Source (jump to first uncovered line)
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"
7
8
namespace mozilla {
9
namespace layers {
10
11
using namespace mozilla::gfx;
12
13
TextureWrapperImage::TextureWrapperImage(TextureClient* aClient, const IntRect& aPictureRect)
14
 : Image(nullptr, ImageFormat::TEXTURE_WRAPPER),
15
   mPictureRect(aPictureRect),
16
   mTextureClient(aClient)
17
0
{
18
0
}
19
20
TextureWrapperImage::~TextureWrapperImage()
21
0
{
22
0
}
23
24
gfx::IntSize
25
TextureWrapperImage::GetSize() const
26
0
{
27
0
  return mTextureClient->GetSize();
28
0
}
29
30
gfx::IntRect
31
TextureWrapperImage::GetPictureRect() const
32
0
{
33
0
  return mPictureRect;
34
0
}
35
36
already_AddRefed<gfx::SourceSurface>
37
TextureWrapperImage::GetAsSourceSurface()
38
0
{
39
0
  TextureClientAutoLock autoLock(mTextureClient, OpenMode::OPEN_READ);
40
0
  if (!autoLock.Succeeded()) {
41
0
    return nullptr;
42
0
  }
43
0
44
0
  RefPtr<DrawTarget> dt = mTextureClient->BorrowDrawTarget();
45
0
  if (!dt) {
46
0
    return nullptr;
47
0
  }
48
0
49
0
  return dt->Snapshot();
50
0
}
51
52
TextureClient*
53
TextureWrapperImage::GetTextureClient(KnowsCompositor* aForwarder)
54
0
{
55
0
  return mTextureClient;
56
0
}
57
58
} // namespace layers
59
} // namespace mozilla