| Flutter Impeller |

Public Member Functions | List of all members
impeller::BufferView Struct Reference

`#include <buffer_view.h>`

## Public Member Functions
| BufferView ()
| BufferView (DeviceBuffer *buffer, Range range)
| BufferView (std::shared_ptr< const DeviceBuffer > buffer, Range range)
Range | GetRange () const
const DeviceBuffer * | GetBuffer () const
std::shared_ptr< const DeviceBuffer > | TakeBuffer ()
| operator bool () const

## Detailed Description

A specific range in a DeviceBuffer.

BufferView can maintain ownership over the DeviceBuffer or not depending on if it is created with a std::shared_ptr or a raw pointer.

Definition at line 19 of file buffer_view.h.

## Constructor & Destructor Documentation

## ◆ BufferView() [1/3]

impeller::BufferView::BufferView | ( |  | ) |

Definition at line 9 of file buffer_view.cc.

9 : buffer_(nullptr), raw_buffer_(nullptr), range_({}) {}

## ◆ BufferView() [2/3]

impeller::BufferView::BufferView | ( | DeviceBuffer * | buffer,
|  | Range | range
| ) |  |

Definition at line 11 of file buffer_view.cc.

12 : buffer_(), raw_buffer_(buffer), range_(range) {}

## ◆ BufferView() [3/3]

impeller::BufferView::BufferView | ( | std::shared_ptr< const DeviceBuffer > | buffer,
|  | Range | range
| ) |  |

Definition at line 14 of file buffer_view.cc.

15 : buffer_(std::move(buffer)), raw_buffer_(nullptr), range_(range) {}

## Member Function Documentation

## ◆ GetBuffer()

const DeviceBuffer * impeller::BufferView::GetBuffer | ( |  | ) | const

Definition at line 17 of file buffer_view.cc.

17 {
18 return raw_buffer_ ? raw_buffer_ : buffer_.get();
19 }

Referenced by impeller::Bind(), impeller::BindVertexBuffer(), impeller::Tessellator::TessellateConvex(), and impeller::testing::TEST_P().

## ◆ GetRange()

Range impeller::BufferView::GetRange | ( |  | ) | const
| inline

Definition at line 27 of file buffer_view.h.

27 { return range_; }

Referenced by impeller::BlitPass::AddCopy(), impeller::Bind(), impeller::BindVertexBuffer(), impeller::BlitCopyBufferToTextureCommandGLES::Encode(), impeller::Tessellator::TessellateConvex(), and impeller::testing::TEST_P().

## ◆ operator bool()

impeller::BufferView::operator bool | ( |  | ) | const
| explicit

Definition at line 30 of file buffer_view.cc.

30 {
31 return buffer_ || raw_buffer_;
32 }

## ◆ TakeBuffer()

std::shared_ptr< const DeviceBuffer > impeller::BufferView::TakeBuffer | ( |  | ) |

Definition at line 21 of file buffer_view.cc.

21 {
22 if (buffer_) {
23 raw_buffer_ = buffer_.get();
24 return std::move(buffer_);
25 } else {
26 return nullptr;
27 }
28 }

The documentation for this struct was generated from the following files:

- impeller/core/buffer_view.h
- impeller/core/buffer_view.cc