Exemplo n.º 1
0
void cDBusOsd::Flush(void)
{
  if (!cOsd::Active())
      return;

#ifndef NO_PNGPP

/*
  struct timeval start;
  struct timeval end;
  struct timezone timeZone;
  gettimeofday(&start, &timeZone);
  bool write = false;
*/

#if VDRVERSNUM >= 10717
  if (IsTrueColor()) {
    LOCK_PIXMAPS;
    int left = Left();
    int top = Top();
    const cRect* vp;
    int vx, vy, vw, vh;
    int x, y;
    const uint8_t *pixel;
    png::image<png::rgba_pixel> *pngfile;
    while (cPixmapMemory *pm = RenderPixmaps()) {
          /*write = true;*/
          vp = &pm->ViewPort();
          vx = vp->X();
          vy = vp->Y();
          vw = vp->Width();
          vh = vp->Height();
          pixel = pm->Data();
          pngfile = new png::image<png::rgba_pixel>(vw, vh);
          for (y = 0; y < vh ; y++) {
              for (x = 0; x < vw; x++) {
                  (*pngfile)[y][x] = png::rgba_pixel(pixel[2], pixel[1], pixel[0], pixel[3]);
                  pixel += 4;
                  }
              }
          cString filename = cString::sprintf("%s/%04x-%d-%d-%d-%d.png", *osd_dir, counter, left, top, vx, vy);
          pngfile->write(*filename);
          provider.SendMessage(new cDbusOsdMsg("Display", filename, left, top, vx, vy));

          counter++;
          delete pngfile;
          delete pm;
          }
  }
#endif
/*
  if (write) {
     gettimeofday(&end, &timeZone);
     int timeNeeded = end.tv_usec - start.tv_usec;
     timeNeeded += (end.tv_sec - start.tv_sec) * 1000000;
     isyslog("dbus2vdr: flushing osd %d needed %d\n", osd_index, timeNeeded);
     }
*/
#endif
}
Exemplo n.º 2
0
	virtual void Flush(void)
	{
		if (!Active() || !m_fb)
			return;

		if (IsTrueColor())
		{
			LOCK_PIXMAPS;
			while (cPixmapMemory *pm =
					dynamic_cast<cPixmapMemory *>(RenderPixmaps()))
			{
				const uint8_t *src = pm->Data();
				char *dst = m_fb + (Left() + pm->ViewPort().Left()) *
						(m_vinfo.bits_per_pixel / 8 ) +
						(Top() + pm->ViewPort().Top()) * m_finfo.line_length;

				for (int y = 0; y < pm->DrawPort().Height(); y++)
				{
					memcpy(dst, src, pm->DrawPort().Width() * sizeof(tColor));
					src += pm->DrawPort().Width() * sizeof(tColor);
					dst += m_finfo.line_length;
				}
#if APIVERSNUM >= 20110
				DestroyPixmap(pm);
#else
				delete pm;
#endif
			}
		}
		else
		{
			for (int i = 0; cBitmap *bitmap = GetBitmap(i); ++i)
			{
				int x1, y1, x2, y2;
				if (bitmap->Dirty(x1, y1, x2, y2))
				{
					char *dst = m_fb + (Left() + bitmap->X0() + x1) *
							(m_vinfo.bits_per_pixel / 8 ) +
							(Top() + bitmap->Y0() + y1) * m_finfo.line_length;

					for (int y = y1; y <= y2; ++y)
					{
						tColor *p = (tColor *)dst;
						for (int x = x1; x <= x2; ++x)
							*p++ = bitmap->GetColor(x, y);

						dst += m_finfo.line_length;
					}
					bitmap->Clean();
				}
			}
		}
	}