// Bitmap buffer has been changed. Upload changes to GPU. void BitmapTexture::AreaUpdated( const RectArea& updateArea, const unsigned char* pixels ) { DALI_LOG_TRACE_METHOD(Debug::Filter::gImage); DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "BitmapTexture::AreaUpdated()\n"); GLenum pixelFormat = GL_RGBA; GLenum pixelDataType = GL_UNSIGNED_BYTE; Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); mContext.ActiveTexture(GL_TEXTURE7); // bind in unused unit so rebind works the first time mContext.Bind2dTexture(mId); if( ! updateArea.IsEmpty() ) { mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); // We always use tightly packed data DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "Update x:%d y:%d w:%d h:%d\n", updateArea.x, updateArea.y, updateArea.width ,updateArea.height ); // TODO: obtain pitch of source image, obtain pixel depth of source image. const unsigned int pitchPixels = mImageWidth; const unsigned int pixelDepth = sizeof(unsigned int); // If the width of the source update area is the same as the pitch, then can // copy the contents in a single contiguous TexSubImage call. if(updateArea.x == 0 && updateArea.width == pitchPixels) { pixels += updateArea.y * pitchPixels * pixelDepth; mContext.TexSubImage2D( GL_TEXTURE_2D,0, updateArea.x, updateArea.y, updateArea.width, updateArea.height, pixelFormat, pixelDataType, pixels ); } else { // Otherwise the source buffer needs to be copied line at a time, as OpenGL ES // does not support source strides. (no GL_UNPACK_ROW_LENGTH supported) unsigned int yBottom = updateArea.y + updateArea.height; pixels += (updateArea.y * pitchPixels + updateArea.x) * pixelDepth; for(unsigned int y = updateArea.y; y < yBottom; y++) { mContext.TexSubImage2D( GL_TEXTURE_2D,0, updateArea.x, y, updateArea.width, 1, pixelFormat, pixelDataType, pixels ); pixels += pitchPixels * pixelDepth; } } INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, updateArea.Area()* GetBytesPerPixel( mPixelFormat )); } }
void ImfManager::PreEditCursorChange( int cursor ) { DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditCursorChange %d\n", cursor ); mPreEditCursorPosition = cursor; }
void ImfManager::PreEditStringChange( unsigned int serial, const std::string text, const std::string commit ) { int visualCursorPosition = 0; if( text.length() > 0 ) { visualCursorPosition = ConvertByteToVisualPosition( text.c_str(), mPreEditCursorPosition ); } DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::PreEditChanged to %s, pre-edit cursor %d \n",text.c_str(), mPreEditCursorPosition ); // get the latest visual cursor pre-edit position Dali::ImfManager handle( this ); Dali::ImfManager::ImfEventData imfEventData( Dali::ImfManager::PREEDIT, text, visualCursorPosition, visualCursorPosition ); Dali::ImfManager::ImfCallbackData callbackData = mEventSignal.Emit( handle, imfEventData ); if( callbackData.update ) { mEditCursorPosition = callbackData.cursorPosition; mSurroundingText = callbackData.currentText; } if( callbackData.preeditResetRequired ) { mPreEditCursorPosition = 0; } }
bool PanGestureDetector::CheckAngleAllowed( Radian angle ) const { bool allowed( false ); if ( mAngleContainer.empty() ) { allowed = true; } else { for ( AngleContainer::const_iterator iter = mAngleContainer.begin(), endIter = mAngleContainer.end(); iter != endIter; ++iter ) { float angleAllowed( iter->first ); float threshold ( iter->second ); DALI_LOG_INFO( gLogFilter, Debug::General, "AngleToCheck: %.2f, CompareWith: %.2f, Threshold: %.2f\n", Degree(angle), Degree(angleAllowed), Degree(threshold) ); float relativeAngle( fabsf( WrapInDomain( angle - angleAllowed, -Math::PI, Math::PI ) ) ); if ( relativeAngle <= threshold ) { allowed = true; break; } } } return allowed; }
void ImfManager::NotifyCursorPosition() { DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::NotifyCursorPosition \n" ); // Set surrounding text also sets the cursor/ anchor position SetSurroundingText( mSurroundingText ); }
void ResourceThreadModel::Load(const ResourceRequest& request) { DALI_ASSERT_DEBUG(request.GetType()->id == ResourceModel); DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __PRETTY_FUNCTION__, request.GetPath().c_str()); scoped_ptr<ModelBuilder> modelBuilder( CreateModelBuilder(request.GetPath()) ); ModelData modelData = ModelData::New(modelBuilder->GetModelName()); const bool success = modelBuilder->Build(modelData); if( success ) { // Construct LoadedResource and ResourcePointer for model data LoadedResource resource( request.GetId(), request.GetType()->id, ResourcePointer(&(modelData.GetBaseObject()))); // Queue the loaded resource mResourceLoader.AddLoadedResource(resource); } else { // add to the failed queue FailedResource resource(request.GetId(), FailureUnknown); mResourceLoader.AddFailedLoad(resource); } }
void BitmapTexture::AssignBitmap( bool generateTexture, const unsigned char* pixels ) { DALI_LOG_TRACE_METHOD(Debug::Filter::gImage); DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "BitmapTexture::AssignBitmap()\n"); GLenum pixelFormat = GL_RGBA; GLenum pixelDataType = GL_UNSIGNED_BYTE; if( generateTexture ) { mContext.GenTextures(1, &mId); } DALI_ASSERT_DEBUG( mId != 0 ); mContext.ActiveTexture(GL_TEXTURE7); // bind in unused unit so rebind works the first time mContext.Bind2dTexture(mId); Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1); // We always use tightly packed data mContext.TexImage2D(GL_TEXTURE_2D, 0, pixelFormat, mWidth, mHeight, 0, pixelFormat, pixelDataType, pixels); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, GetBytesPerPixel(mPixelFormat) * mWidth * mHeight ); }
void TextAttachment::TextureResized( const TextureIdList& oldTextureIds, unsigned int newTextureId ) { bool matched( false ); // check if resized texture is the one we are using for( std::size_t i = 0, count = oldTextureIds.size(); i < count; ++i ) { if( oldTextureIds[i] == mTextureId ) { matched = true; break; } } DALI_LOG_INFO(Debug::Filter::gResource, Debug::General, "TextAttachment::TextureResized() Current texture: %d New texture: %d\n", mTextureId, newTextureId); if( newTextureId == mTextureId ) { // nothing has changed, we are using the new texture already return; } // the texture we're using has been replaced // re-request the text vertex information and update the texture id on the scene graph text attachment if( matched ) { mTextRequestHelper.TextureChanged( mTextureId, newTextureId ); mTextureId = newTextureId; mTextChanged = true; TextChanged(); return; } }
void FrameTime::Sleep() { DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Sleeping\n" ); // Mimic Suspend behaviour Suspend(); }
DynamicsWorldDebug::DynamicsWorldDebug(SceneController& sceneController, const Shader& debugShader) : mDebugMode(0),//(btIDebugDraw::DBG_DrawWireframe),//(0), mSceneController(sceneController) { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); mRenderer = new DynamicsDebugRenderer( debugShader ); }
bool BitmapTexture::CreateGlTexture() { DALI_LOG_TRACE_METHOD(Debug::Filter::gImage); DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Bitmap: %s\n", DALI_LOG_GET_OBJECT_C_STR(this)); if( mBitmap ) { const unsigned char* pixels = mBitmap->GetBuffer(); DALI_ASSERT_DEBUG(pixels != NULL); if( NULL != pixels ) { AssignBitmap( true, pixels ); mBitmap->DiscardBuffer(); } } else { const unsigned char* pixels = NULL; std::vector<unsigned char> pixelData; if( ( NULL == pixels ) && ( true == mClearPixels ) ) { unsigned int size = mWidth * mHeight * Pixel::GetBytesPerPixel(mPixelFormat); pixelData.resize(size, 0); pixels = &pixelData[0]; } AssignBitmap( true, pixels ); } return mId != 0; }
void ResourceThreadModel::Save(const ResourceRequest& request) { DALI_ASSERT_DEBUG(request.GetType()->id == ResourceModel); DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __PRETTY_FUNCTION__, request.GetPath().c_str()); bool success(false); BaseObject* baseObject = dynamic_cast<BaseObject*>(request.GetResource().Get()); if( baseObject != NULL ) { BaseHandle baseHandle(baseObject); ModelData modelData = ModelData::DownCast(baseHandle); if( modelData ) { scoped_ptr<BinaryModelBuilder> modelBuilder (new BinaryModelBuilder(request.GetPath().c_str())); if ( modelBuilder->Write(modelData) ) { success = true; // Construct SavedResource SavedResource resource( request.GetId(), request.GetType()->id); // Queue the loaded resource mResourceLoader.AddSavedResource(resource); } } } if( ! success ) { // add to the failed queue FailedResource resource(request.GetId(), FailureUnknown); mResourceLoader.AddFailedSave(resource); } }
void BitmapTexture::UpdateArea( const RectArea& updateArea ) { DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::General, "BitmapTexture::UpdateArea()\n"); if( mBitmap != 0 ) { const unsigned char* pixels = mBitmap->GetBuffer(); if ( NULL == pixels ) { DALI_LOG_ERROR("bitmap has no data\n"); GlCleanup(); ///!ToDo: Why do we suicide in the case of bad input? } else { if ( mId ) // If the texture is already bound { if( updateArea.IsEmpty() ) { RectArea area; area.x = 0; area.y = 0; area.width = mImageWidth; area.height = mImageHeight; AreaUpdated( area, pixels ); } else { AreaUpdated( updateArea, pixels ); } } } } }
bool TypeRegistry::Register( const std::string& uniqueTypeName, const std::type_info& baseTypeInfo, Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit ) { bool ret = false; std::string baseTypeName = DemangleClassName(baseTypeInfo.name()); RegistryMap::iterator iter = mRegistryLut.find(uniqueTypeName); if( iter == mRegistryLut.end() ) { mRegistryLut[uniqueTypeName] = Dali::TypeInfo(new Internal::TypeInfo(uniqueTypeName, baseTypeName, createInstance)); ret = true; DALI_LOG_INFO( gLogFilter, Debug::Concise, "Type Registration %s(%s)\n", uniqueTypeName.c_str(), baseTypeName.c_str()); } else { DALI_LOG_WARNING("Duplicate name for TypeRegistry for '%s'\n", + uniqueTypeName.c_str()); DALI_ASSERT_ALWAYS(!"Duplicate type name for Type Registation"); } if( callCreateOnInit ) { mInitFunctions.push_back(createInstance); } return ret; }
DynamicsWorld::DynamicsWorld(const std::string& name) : mDebugMode(0), mDynamicsWorld(NULL), mUnit(1.0f), mSlotDelegate(this) { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (\"%s\")\n", __PRETTY_FUNCTION__, name.c_str()); }
void BitmapTexture::ClearAreas( const BitmapClearArray& areaArray, std::size_t blockSize, uint32_t color ) { if(mId > 0) { DALI_LOG_TRACE_METHOD(Debug::Filter::gImage); DALI_LOG_INFO(Debug::Filter::gGLResource, Debug::Verbose, "BitmapTexture::AreaUpdated()\n"); GLenum pixelFormat = GL_RGBA; GLenum pixelDataType = GL_UNSIGNED_BYTE; Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); mContext.ActiveTexture(GL_TEXTURE7); // bind in unused unit so rebind works the first time mContext.Bind2dTexture(mId); size_t numPixels = blockSize*blockSize; size_t bytesPerPixel = Pixel::GetBytesPerPixel(mPixelFormat); char* clearPixels = (char*)malloc(numPixels * bytesPerPixel); for(size_t i=0; i<numPixels; i++) { memcpy(&clearPixels[i*bytesPerPixel], &color, bytesPerPixel); } for( BitmapClearArray::const_iterator iter = areaArray.begin(), endIter = areaArray.end(); iter != endIter ; ++iter) { const Vector2& clearPos((*iter)); mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); // We always use tightly packed data DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "Update x:%0.2f y:%0.2f w:%d h:%d\n", clearPos.x, clearPos.y, blockSize, blockSize ); mContext.TexSubImage2D(GL_TEXTURE_2D, 0, clearPos.x, clearPos.y, blockSize, blockSize, pixelFormat, /* our bitmap format (should match internal format) */ pixelDataType, /* pixel data type */ clearPixels); /* texture data */ INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, numPixels * bytesPerPixel ); } free(clearPixels); } }
DynamicsWorldPtr DynamicsWorld::New() { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); DynamicsWorldPtr dynamicsWorld( new DynamicsWorld( "DefaultWorld" ) ); return dynamicsWorld; }
DynamicsShape::~DynamicsShape() { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); if( mDynamicsShape && Stage::IsInstalled() ) { DeleteShapeMessage( Stage::GetCurrent()->GetUpdateInterface(), *mDynamicsShape ); } }
void ImfManager::DeleteSurroundingText( int index, unsigned int length ) { DALI_LOG_INFO( gLogFilter, Debug::General, "ImfManager::DeleteSurroundingText %d %d \n" index, length ); Dali::ImfManager::ImfEventData imfData( Dali::ImfManager::DELETESURROUNDING, std::string(),index, length ); Dali::ImfManager handle( this ); mEventSignal.Emit( handle, imfData ); }
NativeFrameBufferTexture::NativeFrameBufferTexture( NativeImagePtr nativeImage, Context& context) : FrameBufferTexture(nativeImage->GetWidth(), nativeImage->GetHeight(), nativeImage->GetPixelFormat(), context), mNativeImage(nativeImage) { DALI_LOG_INFO( Debug::Filter::gImage, Debug::General, "NativeFrameBufferTexture created 0x%x\n", &nativeImage ); }
void FrameTime::Resume() { DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Resuming\n" ); SetLastSyncTime(); // Should only update the last Sync time so the elapsed time during suspension is taken into consideration when we next update. mFirstFrame = TRUE; mRunning = TRUE; }
void FrameTime::WakeUp() { DALI_LOG_INFO( gLogFilter, Debug::Concise, "FrameTime: Waking Up\n" ); SetLastSyncTime(); mLastSyncTimeAtUpdate = mLastSyncTime; // We do not want any animations to progress as we have just been woken up. mFirstFrame = TRUE; mRunning = TRUE; }
void PanGestureDetector::SetMaximumTouchesRequired(unsigned int maximum) { DALI_ASSERT_ALWAYS( maximum > 0 && "Can only set a positive number of maximum touches" ); if (mMaximumTouches != maximum) { DALI_LOG_INFO( gLogFilter, Debug::Concise, "Maximum Touches Set: %d\n", maximum ); mMaximumTouches = maximum; if (!mAttachedActors.empty()) { DALI_LOG_INFO( gLogFilter, Debug::General, "Updating Gesture Detector\n"); mGestureEventProcessor.GestureDetectorUpdated(this); } } }
void DynamicsCylinderShape::Initialize(const float radius, const float length) { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %.1f length: %.1f)\n", __PRETTY_FUNCTION__, radius, length); mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); const float worldScale((1.0f / mWorld.GetWorldScale()) ); mShape->Initialize( Dali::DynamicsShape::CYLINDER, Vector3( radius * worldScale, length * worldScale, 0.0f ) ); DynamicsShape::Initialize(); }
DynamicsDebugRenderer::DynamicsDebugRenderer(const Shader& debugShader) : mShader(const_cast<Shader&>(debugShader)), mContext(NULL), mBufferIndex(0), mViewMatrix(Matrix::IDENTITY), mProjectionMatrix(Matrix::IDENTITY), mNumberOfPoints(0) { DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); }
void CompositorOutput::CallbacksDone() { mDataReady = true; // formula for DPI is screen resolution / physical size in inches gDpiHorizontal = (static_cast<float>( mXresolution) / mMonitorWidth) + 0.5f; gDpiVertical = (static_cast<float>( mYresolution )/ mMonitorHeight) +0.5f; DALI_LOG_INFO( gLogFilter, Debug::General, "Monitor DPI %d x %d", gDpiHorizontal, gDpiVertical ); }
void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan) { if ( !mDetectedSignal.Empty() ) { // Guard against destruction during signal emission Dali::PanGestureDetector handle( this ); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Emitting Signal (%p)\n", this ); mDetectedSignal.Emit( actor, pan ); } }
void MouseWheelEventProcessor::ProcessMouseWheelEvent(const Integration::MouseWheelEvent& event) { Stage& stage = mStage; MouseWheelEvent mouseWheelEvent( event.direction, event.modifiers, event.point, event.z, event.timeStamp ); HitTestAlgorithm::Results hitTestResults; HitTestAlgorithm::HitTest( Dali::Stage(&stage), event.point, hitTestResults, IsActorMouseWheelableFunction ); DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", event.point.x, event.point.y, ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. Dali::Actor consumedActor = EmitMouseWheelSignals( hitTestResults.actor, mouseWheelEvent ); DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); }
void BitmapTexture::UploadBitmapArray( const BitmapUploadArray& bitmapArray ) { if( mId == 0 ) { CreateGlTexture(); } mContext.ActiveTexture(GL_TEXTURE7); // bind in unused unit so rebind works the first time mContext.Bind2dTexture(mId); mContext.PixelStorei(GL_UNPACK_ALIGNMENT, 1); // We always use tightly packed data GLenum pixelFormat = GL_RGBA; GLenum pixelDataType = GL_UNSIGNED_BYTE; Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); // go through each bitmap uploading it for( BitmapUploadArray::const_iterator iter = bitmapArray.begin(), endIter = bitmapArray.end(); iter != endIter ; ++iter) { const BitmapUpload& bitmapItem((*iter)); DALI_ASSERT_ALWAYS(bitmapItem.mPixelData); const unsigned char* pixels = bitmapItem.mPixelData; DALI_ASSERT_DEBUG( (pixels!=NULL) && "bitmap has no data \n"); unsigned int bitmapWidth(bitmapItem.mWidth); unsigned int bitmapHeight(bitmapItem.mHeight); DALI_LOG_INFO(Debug::Filter::gImage, Debug::General, "upload bitmap to texture :%d y:%d w:%d h:%d\n", bitmapItem.mXpos, bitmapItem.mYpos, bitmapWidth, bitmapHeight); mContext.TexSubImage2D(GL_TEXTURE_2D, 0, /* mip map level */ bitmapItem.mXpos, /* X pos */ bitmapItem.mYpos, /* Y pos */ bitmapWidth, /* width */ bitmapHeight, /* height */ pixelFormat, /* our bitmap format (should match internal format) */ pixelDataType, /* pixel data type */ pixels); /* texture data */ if( BitmapUpload::DISCARD_PIXEL_DATA == bitmapItem.mDiscard) { delete [] bitmapItem.mPixelData; } } }
void FrameTime::SetSyncTime( unsigned int frameNumber ) { // Only set the render time if we are running if ( mRunning ) { SetLastSyncTime(); mLastSyncFrameNumber = frameNumber; DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: SetSyncTime(): Frame: %u: Time: %u\n", mLastSyncFrameNumber, (unsigned int) ( mLastSyncTime / MICROSECONDS_PER_MILLISECOND ) ); } }