示例#1
0
RawBitmap::RawBitmap(unsigned nWidth, unsigned nHeight)
  :width(nWidth), height(nHeight),
   corrected_width(CorrectedWidth(nWidth)),
   buffer(new RawColor[corrected_width * height]),
   texture(new GLTexture(corrected_width, nHeight))
{
  assert(nWidth > 0);
  assert(nHeight > 0);

  texture->EnableInterpolation();

  AddSurfaceListener(*this);
}
示例#2
0
bool
Bitmap::LoadFile(const TCHAR *path)
{
  assert(path != nullptr && *path != _T('\0'));

  Reset();

  pathName = path;
  AddSurfaceListener(*this);

  if (!surface_valid)
    return true;

  return Reload();
}
示例#3
0
文件: Bitmap.cpp 项目: macsux/XCSoar
bool
Bitmap::load(unsigned _id)
{
  assert(_id != 0);

  reset();

  id = _id;
  AddSurfaceListener(*this);

  if (!surface_valid)
    return true;

  return Reload();
}
示例#4
0
bool
Bitmap::Load(ResourceId _id, Type _type)
{
  assert(_id.IsDefined());

  Reset();

  id = _id;
  type = _type;
  AddSurfaceListener(*this);

  if (!surface_valid)
    return true;

  return Reload();
}
示例#5
0
void
BufferCanvas::Create(PixelSize new_size)
{
  assert(!active);

  Destroy();
  texture = new GLTexture(new_size.cx, new_size.cy);

  if (OpenGL::frame_buffer_object && OpenGL::render_buffer_stencil) {
    frame_buffer = new GLFrameBuffer();

    stencil_buffer = new GLRenderBuffer();
    stencil_buffer->Bind();
    PixelSize size = texture->GetAllocatedSize();
    stencil_buffer->Storage(OpenGL::render_buffer_stencil, size.cx, size.cy);
    stencil_buffer->Unbind();
  }

  Canvas::Create(new_size);
  AddSurfaceListener(*this);
}