Exemplo n.º 1
0
HRESULT CDxtexDoc::Resize(DWORD dwWidthNew, DWORD dwHeightNew)
{
    HRESULT hr;
    LPDIRECT3DTEXTURE9 pmiptexNew;
    LPDIRECT3DDEVICE9 pd3ddev = PDxtexApp()->Pd3ddev();
    
    hr = pd3ddev->CreateTexture(dwWidthNew, dwHeightNew, m_numMips, 
         0, GetFormat(m_ptexOrig), D3DPOOL_MANAGED, &pmiptexNew, NULL);
    if (FAILED(hr))
        return hr;
    if (FAILED(BltAllLevels(D3DCUBEMAP_FACE_FORCE_DWORD, m_ptexOrig, pmiptexNew)))
        return hr;
    ReleasePpo(&m_ptexOrig);
    m_ptexOrig = pmiptexNew;

    if( m_ptexNew != NULL )
    {
        hr = pd3ddev->CreateTexture(dwWidthNew, dwHeightNew, m_numMips, 
             0, GetFormat(m_ptexOrig), D3DPOOL_MANAGED, &pmiptexNew, NULL);
        if (FAILED(hr))
            return hr;
        if (FAILED(BltAllLevels(D3DCUBEMAP_FACE_FORCE_DWORD, m_ptexNew, pmiptexNew)))
            return hr;
        ReleasePpo(&m_ptexNew);
        m_ptexNew = pmiptexNew;
    }

    m_dwWidth = dwWidthNew;
    m_dwHeight = dwHeightNew;
    SetModifiedFlag(TRUE);
    UpdateAllViews(NULL, 4);

    return S_OK;
}
Exemplo n.º 2
0
void ESDSinkNode::GetFlavor(flavor_info * outInfo, int32 id)
{
	CALLED();

	outInfo->flavor_flags = B_FLAVOR_IS_GLOBAL;
//	outInfo->possible_count = 0;	// any number
	outInfo->possible_count = 1;	// only 1
	outInfo->in_format_count = 0; // no inputs
	outInfo->in_formats = 0;
	outInfo->out_format_count = 0; // no outputs
	outInfo->out_formats = 0;
	outInfo->internal_id = id;
	
	outInfo->name = new char[256];
		strcpy(outInfo->name, "ESounD Out");
	outInfo->info = new char[256];
		strcpy(outInfo->info, "The ESounD Sink node outputs a network Enlightenment Sound Daemon.");
	outInfo->kinds = /*B_TIME_SOURCE | *//*B_CONTROLLABLE | */ 0;

#if ENABLE_INPUT
	outInfo->kinds |= B_BUFFER_PRODUCER | B_PHYSICAL_INPUT;
	outInfo->out_format_count = 1; // 1 output
	media_format * outformats = new media_format[outInfo->out_format_count];
	GetFormat(&outformats[0]);
	outInfo->out_formats = outformats;
#endif
	
	outInfo->kinds |= B_BUFFER_CONSUMER | B_PHYSICAL_OUTPUT;
	outInfo->in_format_count = 1; // 1 input
	media_format * informats = new media_format[outInfo->in_format_count];
	GetFormat(&informats[0]);
	outInfo->in_formats = informats;
}
Exemplo n.º 3
0
void Image::Resize(const Extent3D& extent, const ColorRGBAd& fillColor, const Offset3D& offset)
{
    if (extent != GetExtent())
    {
        /* Store ownership of current image buffer in temporary image */
        Image prevImage;

        prevImage.extent_   = GetExtent();
        prevImage.format_   = GetFormat();
        prevImage.dataType_ = GetDataType();
        prevImage.data_     = std::move(data_);

        if ( extent.width  > GetExtent().width  ||
             extent.height > GetExtent().height ||
             extent.depth  > GetExtent().depth )
        {
            /* Resize image buffer with fill color */
            extent_ = extent;
            data_   = GenerateImageBuffer(GetFormat(), GetDataType(), GetNumPixels(), fillColor);
        }
        else
        {
            /* Resize image buffer with uninitialized image buffer */
            extent_ = extent;
            data_   = GenerateEmptyByteBuffer(GetDataSize(), false);
        }

        /* Copy previous image into new image */
        Blit(offset, prevImage, { 0, 0, 0 }, prevImage.GetExtent());
    }
}
Exemplo n.º 4
0
//-------------------------------------------------------------------------
NS_IMETHODIMP nsClipboard::HasDataMatchingFlavors(const char** aFlavorList,
                                                  PRUint32 aLength,
                                                  PRInt32 aWhichClipboard,
                                                  bool *_retval)
{
  *_retval = false;
  if (aWhichClipboard != kGlobalClipboard || !aFlavorList)
    return NS_OK;

  for (PRUint32 i = 0;i < aLength; ++i) {
#ifdef DEBUG
    if (strcmp(aFlavorList[i], kTextMime) == 0)
      NS_WARNING ( "DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD" );
#endif

    UINT format = GetFormat(aFlavorList[i]);
    if (IsClipboardFormatAvailable(format)) {
      *_retval = true;
      break;
    }
    else {
      // We haven't found the exact flavor the client asked for, but maybe we can
      // still find it from something else that's on the clipboard...
      if (strcmp(aFlavorList[i], kUnicodeMime) == 0) {
        // client asked for unicode and it wasn't present, check if we have CF_TEXT.
        // We'll handle the actual data substitution in the data object.
        if (IsClipboardFormatAvailable(GetFormat(kTextMime)))
          *_retval = true;
      }
    }
  }

  return NS_OK;
}
Exemplo n.º 5
0
void MapServerDlg::UpdateEnabling()
{
	GetTextToFile()->Enable(m_bToFile);
	GetDotdotdot()->Enable(m_bToFile);

	// For now, going straight to memory must be PNG
	if (!m_bToFile)
		GetFormat()->SetSelection(1);
	GetFormat()->Enable(m_bToFile);
}
Exemplo n.º 6
0
bool
MemoryTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor)
{
  MOZ_ASSERT(IsValid());
  if (!IsAllocated() || GetFormat() == gfx::FORMAT_UNKNOWN) {
    return false;
  }
  aDescriptor = SurfaceDescriptorMemory(reinterpret_cast<uintptr_t>(mBuffer),
                                        GetFormat());
  return true;
}
Exemplo n.º 7
0
bool
ShmemTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor)
{
  MOZ_ASSERT(IsValid());
  if (!IsAllocated() || GetFormat() == gfx::FORMAT_UNKNOWN) {
    return false;
  }

  aDescriptor = SurfaceDescriptorShmem(mShmem, GetFormat());

  return true;
}
TemporaryRef<gfx::DataSourceSurface>
ImageDataSerializerBase::GetAsSurface()
{
  MOZ_ASSERT(IsValid());
  SurfaceBufferInfo* info = GetBufferInfo(mData);
  gfx::IntSize size(info->width, info->height);
  uint32_t stride = gfxASurface::BytesPerPixel(
    gfx::SurfaceFormatToImageFormat(GetFormat())) * info->width;
  RefPtr<gfx::DataSourceSurface> surf =
    gfx::Factory::CreateWrappingDataSourceSurface(GetData(), stride, size, GetFormat());
  return surf.forget();
}
Exemplo n.º 9
0
bool
ShmemTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
{
  MOZ_ASSERT(GetFormat() != gfx::SurfaceFormat::UNKNOWN);
  if (GetFormat() == gfx::SurfaceFormat::UNKNOWN) {
    return false;
  }

  aOutDescriptor = SurfaceDescriptorBuffer(mDescriptor, MemoryOrShmem(mShmem));

  return true;
}
Exemplo n.º 10
0
TemporaryRef<gfxImageSurface>
ImageDataSerializerBase::GetAsThebesSurface()
{
  MOZ_ASSERT(IsValid());
  SurfaceBufferInfo* info = GetBufferInfo(mData);
  uint32_t stride = gfxASurface::BytesPerPixel(
    gfx::SurfaceFormatToImageFormat(GetFormat())) * info->width;
  gfxIntSize size(info->width, info->height);
  RefPtr<gfxImageSurface> surf =
    new gfxImageSurface(GetData(), size, stride,
                        gfx::SurfaceFormatToImageFormat(GetFormat()));
  return surf.forget();
}
Exemplo n.º 11
0
bool
MemoryTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
{
  MOZ_ASSERT(GetFormat() != gfx::SurfaceFormat::UNKNOWN);
  if (GetFormat() == gfx::SurfaceFormat::UNKNOWN) {
    return false;
  }

  uintptr_t ptr = reinterpret_cast<uintptr_t>(mBuffer);
  aOutDescriptor = SurfaceDescriptorBuffer(mDescriptor, MemoryOrShmem(ptr));

  return true;
}
Exemplo n.º 12
0
bool LoadDDSFile(TCHAR* pszFile, AMD_TC_Texture& texture)
{
   FILE* pSourceFile = _tfopen(pszFile, _T("rb"));

   if (!pSourceFile) return false;

   DWORD dwFileHeader;
   fread(&dwFileHeader, sizeof(DWORD), 1, pSourceFile);
   if(dwFileHeader != DDS_HEADER)
   {
      _tprintf(_T("Source file is not a valid DDS.\n"));
      fclose(pSourceFile);
      return false;
   }

   DDSD2 ddsd;
   fread(&ddsd, sizeof(DDSD2), 1, pSourceFile);

   memset(&texture, 0, sizeof(texture));
   texture.dwSize = sizeof(texture);
   texture.dwWidth = ddsd.dwWidth;
   texture.dwHeight = ddsd.dwHeight;
   texture.dwPitch = ddsd.lPitch;

   if(ddsd.ddpfPixelFormat.dwRGBBitCount==32)
      texture.format = AMD_TC_FORMAT_ARGB_8888;
   else if(ddsd.ddpfPixelFormat.dwRGBBitCount==24)
      texture.format = AMD_TC_FORMAT_RGB_888;
   else if(GetFormat(ddsd.ddpfPixelFormat.dwPrivateFormatBitCount) != AMD_TC_FORMAT_Unknown)
      texture.format = GetFormat(ddsd.ddpfPixelFormat.dwPrivateFormatBitCount);
   else if(GetFormat(ddsd.ddpfPixelFormat.dwFourCC) != AMD_TC_FORMAT_Unknown)
      texture.format = GetFormat(ddsd.ddpfPixelFormat.dwFourCC);
   else
   {
      _tprintf(_T("Unsupported source format.\n"));
      fclose(pSourceFile);
      return false;
   }

   // Init source texture
   texture.dwDataSize = AMD_TC_CalculateBufferSize(&texture);
   texture.pData = (AMD_TC_BYTE*) malloc(texture.dwDataSize);

   fread(texture.pData, texture.dwDataSize, 1, pSourceFile);
   fclose(pSourceFile);

   return true;
}
Exemplo n.º 13
0
int SUBTITLESOURCE::doClose()
{
	int i,j;

	if (GetFormat()==SUBFORMAT_SSA)
	{
		for (i=0;i<(int)dwNbrOfStyles;i++)
		{
			for (j=0;j<18;j++)	
			{
				if (lplpSSAStyles[i]->lpcArray[j]) delete lplpSSAStyles[i]->lpcArray[j];
			}
			delete lplpSSAStyles[i];
		}

		for (j=0;j<14;j++)
		{
			if (lpSSAHeader->lpcArray && lpSSAHeader->lpcArray[j]) delete lpSSAHeader->lpcArray[j];
		}
	}
	if (lplpSSAStyles) delete lplpSSAStyles;
	if (lpSSAHeader) delete lpSSAHeader;
	lplpSSAStyles=NULL;
	lpSSAHeader=NULL;

	return 0;
}
Exemplo n.º 14
0
//
// FindUnicodeFromPlainText
//
// we are looking for text/unicode and we failed to find it on the clipboard first,
// try again with text/plain. If that is present, convert it to unicode.
//
bool
nsClipboard :: FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, PRUint32* outDataLen )
{
  bool dataFound = false;

  // we are looking for text/unicode and we failed to find it on the clipboard first,
  // try again with text/plain. If that is present, convert it to unicode.
  nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, GetFormat(kTextMime), nullptr, outData, outDataLen);
  if ( NS_SUCCEEDED(loadResult) && *outData ) {
    const char* castedText = reinterpret_cast<char*>(*outData);          
    PRUnichar* convertedText = nullptr;
    PRInt32 convertedTextLen = 0;
    nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode ( castedText, *outDataLen, 
                                                              &convertedText, &convertedTextLen );
    if ( convertedText ) {
      // out with the old, in with the new 
      nsMemory::Free(*outData);
      *outData = convertedText;
      *outDataLen = convertedTextLen * sizeof(PRUnichar);
      dataFound = true;
    }
  } // if plain text data on clipboard

  return dataFound;

} // FindUnicodeFromPlainText
FTextureResource* UTextureRenderTarget2D::CreateResource()
{
	UWorld* World = GetWorld();
	ERHIFeatureLevel::Type FeatureLevel = World != nullptr ? World->FeatureLevel : GMaxRHIFeatureLevel;
	if (FeatureLevel <= ERHIFeatureLevel::ES2)
	{
		EPixelFormat Format = GetFormat();
		if ((!GSupportsRenderTargetFormat_PF_FloatRGBA && (Format == PF_FloatRGBA || Format == PF_FloatRGB))
			|| Format == PF_A16B16G16R16)
		{
			OverrideFormat = PF_B8G8R8A8;
		}
	}

	if (bAutoGenerateMips)
	{
		NumMips = FGenericPlatformMath::CeilToInt(FGenericPlatformMath::Log2(FGenericPlatformMath::Max(SizeX, SizeY)));
	}
	else
	{
		NumMips = 1;
	}
 
	FTextureRenderTarget2DResource* Result = new FTextureRenderTarget2DResource(this);
	return Result;
}
Exemplo n.º 16
0
 void ImageWriter::WriteBitmap(Bitmap* bmp, ProgressCallback* callback)
 {
     if (bmp->GetWidth() != GetWidth()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same width as ImageWriter");
     if (bmp->GetHeight() != GetHeight()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same height as ImageWriter");
     if (bmp->GetFormat() != GetFormat()) XLI_THROW_INVALID_ARGUMENT("Bitmap must have same format as ImageWriter");
     Write(bmp->GetPtr(), bmp->GetPitch(), callback);
 }
Exemplo n.º 17
0
MediaReader::MediaReader(
				size_t defaultChunkSize,
				float defaultBitRate,
				const flavor_info * info,
				BMessage * config,
				BMediaAddOn * addOn)
	: BMediaNode("MediaReader"),
	  BBufferProducer(B_MEDIA_MULTISTREAM),
	  AbstractFileInterfaceNode(defaultChunkSize, defaultBitRate, info, config, addOn)
{
	CALLED();

	// null some fields
	fBufferGroup = 0;	
	// start enabled
	fOutputEnabled = true;
	// don't overwrite available space, and be sure to terminate
	strncpy(output.name,"MediaReader Output",B_MEDIA_NAME_LENGTH-1);
	output.name[B_MEDIA_NAME_LENGTH-1] = '\0';
	// initialize the output
	output.node = media_node::null;     // until registration
	output.source = media_source::null; // until registration
	output.destination = media_destination::null;
	GetFormat(&output.format);
}
Exemplo n.º 18
0
/// <summary>
/// Calculates the Julian date from the epoch parameter. The format of
/// the epoch can be JulianDate, Date or Packed date format.
/// </summary>
/// <param name="epoch">The time instance in JulianDate, Date or Packed date format</param>
/// <returns>The time instance in double</returns>
int Ephemeris::GetJulianDate(std::string epoch, double &julianDate)
{
	DateTime dateTime;

	std::string data = epoch.substr(2, epoch.length() - 2);
	EpochFormat epochFormat = GetFormat(epoch);
	switch (epochFormat)
	{
		case JulianDate:
			julianDate = atof(data.c_str());
			break;
		case Date:
			DateFormat(epoch, dateTime);
			ToJulianDate(dateTime, julianDate);
			break;
		case PackedDate:
			PackedDateFormat(epoch, dateTime);
			ToJulianDate(dateTime, julianDate);
			break;
		case UndefinedFormat:
			Error::_errMsg = "Undefined format for epoch!";
			Error::PushLocation(__FILE__, __FUNCTION__, __LINE__);
			return 1;
		default:
			Error::_errMsg = "Invalid value for epoch!";
			Error::PushLocation(__FILE__, __FUNCTION__, __LINE__);
			return 1;
	}

	return 0;
}
Exemplo n.º 19
0
//--------------------------------------------------------------------------------------
// Name: GetLoopRegionBytes()
// Desc: Gets the loop region, in terms of bytes
//--------------------------------------------------------------------------------------
HRESULT WaveFile::GetLoopRegionBytes( DWORD* pdwStart, DWORD* pdwLength ) const
{
    assert( pdwStart != NULL );
    assert( pdwLength != NULL );

    // If no loop region is explicitly specified, loop the entire file
    *pdwStart = 0;
    GetDuration( pdwLength );

    // We'll need the wave format to convert from samples to bytes
    WAVEFORMATEXTENSIBLE wfx;
    if( FAILED( GetFormat( &wfx ) ) )
        return E_FAIL;

    // See if the file contains an embedded loop region
    DWORD dwLoopStartSamples;
    DWORD dwLoopLengthSamples;
    if( FAILED( GetLoopRegion( &dwLoopStartSamples, &dwLoopLengthSamples ) ) )
        return S_FALSE;

    // For PCM, multiply by bytes per sample
    DWORD cbBytesPerSample = wfx.Format.nChannels * wfx.Format.wBitsPerSample / 8;
    *pdwStart = dwLoopStartSamples * cbBytesPerSample;
    *pdwLength = dwLoopLengthSamples * cbBytesPerSample;

    return S_OK;
}
Exemplo n.º 20
0
// They made an offer to us.  We should make sure that the offer is
// acceptable, and then we can add any requirements we have on top of
// that.  We leave wildcards for anything that we don't care about.
status_t MediaReader::FormatProposal(
				const media_source & output_source,
				media_format * format)
{
	CALLED();

	if (output.source != output_source) {
		PRINT("\t<- B_MEDIA_BAD_SOURCE\n");
		return B_MEDIA_BAD_SOURCE; // we only have one output so that better be it
	}
	/*	media_format * myFormat = GetFormat();
	fprintf(stderr,"proposed format: ");
	print_media_format(format);
	fprintf(stderr,"\n");
	fprintf(stderr,"my format: ");
	print_media_format(myFormat);
	fprintf(stderr,"\n"); */
	// Be's format_is_compatible doesn't work.
	//	if (!format_is_compatible(*format,*myFormat)) {
	media_format myFormat;
	GetFormat(&myFormat);
	if (!format_is_acceptible(*format,myFormat)) {
		PRINT("\t<- B_MEDIA_BAD_FORMAT\n");
		return B_MEDIA_BAD_FORMAT;
	}
	AddRequirements(format);
	return B_OK;
}
Exemplo n.º 21
0
BOOL CGridCell::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar)
{
    DWORD dwStyle = ES_LEFT;
    if (GetFormat() & DT_RIGHT) 
        dwStyle = ES_RIGHT;
    else if (GetFormat() & DT_CENTER) 
        dwStyle = ES_CENTER;

    m_bEditing = TRUE;
    
    // InPlaceEdit auto-deletes itself
    CGridCtrl* pGrid = GetGrid();
    m_pEditWnd = new CInPlaceEdit(pGrid, rect, dwStyle, nID, nRow, nCol, GetText(), nChar);
    
    return TRUE;
}
Exemplo n.º 22
0
Sound::Sound(const std::wstring& waveResourceName, bool loopForever, bool hasReverb) :
	m_SoundCallbacks(this),
	m_SubmixVoice(nullptr)
{
	auto waveFile = RiffFile::Create(waveResourceName);
	Assert(waveFile.GetFormat() == RiffFourCC::WAVE);

	ZeroMemory(&m_WaveFormat, sizeof(m_WaveFormat));
	ZeroMemory(&m_AudioBuffer, sizeof(m_AudioBuffer));

	const auto& formatChunk = waveFile.GetChunk(RiffFourCC::FMT);
	Assert(sizeof(m_WaveFormat) >= formatChunk.GetSize());
	memcpy(&m_WaveFormat, formatChunk.GetData(), formatChunk.GetSize());

	auto& dataChunk = waveFile.GetChunk(RiffFourCC::DATA);
	m_SoundDataBuffer = std::move(dataChunk.GetDataBuffer());

	m_AudioBuffer.AudioBytes = dataChunk.GetSize();
	m_AudioBuffer.pAudioData = m_SoundDataBuffer.get();
	m_AudioBuffer.Flags = XAUDIO2_END_OF_STREAM;
	m_AudioBuffer.LoopCount = loopForever ? XAUDIO2_LOOP_INFINITE : 0;

	if (hasReverb)
	{
		m_SubmixVoice = AudioManager::GetInstance().CreateSubmixVoice(m_WaveFormat);
	}
}
Exemplo n.º 23
0
bool
BufferTextureData::BorrowMappedData(MappedTextureData& aData)
{
  if (GetFormat() == gfx::SurfaceFormat::YUV) {
    return false;
  }

  gfx::IntSize size = GetSize();

  aData.data = GetBuffer();
  aData.size = size;
  aData.format = GetFormat();
  aData.stride = ImageDataSerializer::ComputeRGBStride(aData.format, size.width);

  return true;
}
Exemplo n.º 24
0
BEGIN_INANITY_AUDIO

size_t Source::GetSize() const
{
	Format format = GetFormat();
	return GetSamplesCount() * format.bitsPerSample * format.channelsCount / 8;
}
Exemplo n.º 25
0
/*******************************************************************************
* Function Name  : LCD_TouchRead( )
* Author				 : Anilandro
* Description    : Lectura de puntero sobre pantalla con versión Portrait y Landscape
* Input          : None
* Output         : None
* Return         :
* Attention		 : None
*******************************************************************************/
uint8_t LCD_TouchRead(Coordinate * displayLCD){
  uint16_t px,py,x,y;
  int p,f;

  //char cadena[20];

  GetFormat();							 /*obtiene valor de formato de pantalla activo*/
  p=0;
  f=0;

  while(f<30){
    getDisplayPoint(&display, Read_Ads7846(), &matrix ) ;	 /*lee la posición del puntero sobre la pantalla*/
    px=display.x;
    py=display.y;
    if((PMode2==0)&&(py<400)){x=px,y=py;p=1;break;}
    if((PMode2==1)&&(px<400)){x=px,y=py;p=1;break;}
    f++;
  }

  if(f>=30){p=0;x=400;y=400;}
  displayLCD->x = x;
  displayLCD->y =	y;

  return(p);
}
Exemplo n.º 26
0
bool DirFileSource::init() {
  int err = 0;

  _frameCount = 0;
  FormatType *ft = GetFormat(_filename.latin1(), &err);

  if (err == GD_E_OK) {
    _fieldList.append("INDEX");
    for (int i = 0; i < ft->n_lincom; i++) {
      _fieldList.append(ft->lincomEntries[i].field);
    }

    for (int i = 0; i < ft->n_multiply; i++) {
      _fieldList.append(ft->multiplyEntries[i].field);
    }

    for (int i = 0; i < ft->n_linterp; i++) {
      _fieldList.append(ft->linterpEntries[i].field);
    }

    for (int i = 0; i < ft->n_bit; i++) {
      _fieldList.append(ft->bitEntries[i].field);
    }

    for (int i = 0; i < ft->n_phase; i++) {
      _fieldList.append(ft->phaseEntries[i].field);
    }

    for (int i = 0; i < ft->n_raw; i++) {
      _fieldList.append(ft->rawEntries[i].field);
    }
  }
  return update() == KstObject::UPDATE;
}
Exemplo n.º 27
0
void
TextureHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{
  aStream << aPrefix;
  aStream << nsPrintfCString("%s (0x%p)", Name(), this).get();
  // Note: the TextureHost needs to be locked before it is safe to call
  //       GetSize() and GetFormat() on it.
  if (Lock()) {
    AppendToString(aStream, GetSize(), " [size=", "]");
    AppendToString(aStream, GetFormat(), " [format=", "]");
    Unlock();
  }
  AppendToString(aStream, mFlags, " [flags=", "]");
#ifdef MOZ_DUMP_PAINTING
  if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
    nsAutoCString pfx(aPrefix);
    pfx += "  ";

    aStream << "\n" << pfx.get() << "Surface: ";
    RefPtr<gfx::DataSourceSurface> dSurf = GetAsSurface();
    if (dSurf) {
      aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
    }
  }
#endif
}
Exemplo n.º 28
0
  void ImageAccessor::ToMatlabString(std::string& target) const
  {
    ChunkedBuffer buffer;

    switch (GetFormat())
    {
      case PixelFormat_Grayscale8:
        ToMatlabStringInternal<uint8_t>(buffer, *this);
        break;

      case PixelFormat_Grayscale16:
        ToMatlabStringInternal<uint16_t>(buffer, *this);
        break;

      case PixelFormat_SignedGrayscale16:
        ToMatlabStringInternal<int16_t>(buffer, *this);
        break;

      case PixelFormat_Float32:
        ToMatlabStringInternal<float>(buffer, *this);
        break;

      case PixelFormat_RGB24:
        RGB24ToMatlabString(buffer, *this);
        break;

      default:
        throw OrthancException(ErrorCode_NotImplemented);
    }   

    buffer.Flatten(target);
  }
Exemplo n.º 29
0
static orl_return sectionInit( orl_sec_handle shnd )
{
    section_type        type;
    return_val          error = OKAY;

    type = IdentifySec( shnd );
    switch( type ) {
        case SECTION_TYPE_SYM_TABLE:
            symbolTable = shnd;
            // Might have a label or relocation in symbol section
            error = registerSec( shnd, type );
            if( error == OKAY ) {
                error = createLabelList( shnd );
            }
            break;
        case SECTION_TYPE_DYN_SYM_TABLE:
            dynSymTable = shnd;
            // Might have a label or relocation in dynsym section
            error = registerSec( shnd, type );
            if( error == OKAY ) {
                error = createLabelList( shnd );
            }
            break;
        case SECTION_TYPE_DRECTVE:
            if( GetFormat() == ORL_OMF ) {
                drectveSection = shnd;
                break;
            } // else fall through
        case SECTION_TYPE_BSS:
            error = registerSec( shnd, type );
            if( error == OKAY ) {
                error = createLabelList( shnd );
            }
            break;
        case SECTION_TYPE_RELOCS:
            // Ignore OMF relocs section
            break;
        case SECTION_TYPE_LINES:
            debugHnd = shnd;
            type = SECTION_TYPE_DATA;
            // fall through
        case SECTION_TYPE_TEXT:
        case SECTION_TYPE_PDATA:
        case SECTION_TYPE_DATA:
        default: // Just in case we get a label or relocation in these sections
            error = registerSec( shnd, type );
            if( error == OKAY ) {
                error = textOrDataSectionInit( shnd );
            }
            break;
    }
    switch( error ) {
        case OUT_OF_MEMORY:
           return( ORL_OUT_OF_MEMORY );
        case ERROR:
           return( ORL_ERROR );
    }
    return( ORL_OKAY );
}