Commit 5600d3f69cb9a57d55b2fad694d2a9f53ba700d6

Authored by Richard Huang
2 parents cc06a79b e8a2176f

[dali_1.9.3] Merge branch 'devel/master'

Change-Id: I55ab568774c7baf8c94dff410f0b8e74f83574fb
examples/deferred-shading/deferred-shading.cpp
@@ -458,6 +458,26 @@ void RegisterDepthProperties(float depth, float near, Handle& h) @@ -458,6 +458,26 @@ void RegisterDepthProperties(float depth, float near, Handle& h)
458 } 458 }
459 459
460 //============================================================================= 460 //=============================================================================
  461 +/// Create a String whose size can be evaluated at compile time
  462 +struct ConstantString
  463 +{
  464 + const char * const string;
  465 + const uint16_t size;
  466 +
  467 + template<uint16_t inputSize>
  468 + constexpr ConstantString(const char (&input)[inputSize])
  469 + : string(input),
  470 + size(inputSize)
  471 + {
  472 + }
  473 +};
  474 +
  475 +constexpr ConstantString POSITION_STRING("position");
  476 +constexpr ConstantString RADIUS_STRING("radius");
  477 +constexpr ConstantString COLOR_STRING("color");
  478 +constexpr uint16_t LIGHT_SOURCE_BUFFER_SIZE(128u);
  479 +
  480 +//=============================================================================
461 class DeferredShadingExample : public ConnectionTracker 481 class DeferredShadingExample : public ConnectionTracker
462 { 482 {
463 public: 483 public:
@@ -711,17 +731,17 @@ private: @@ -711,17 +731,17 @@ private:
711 auto iPropLightColor = light.RegisterProperty("lightcolor", color); 731 auto iPropLightColor = light.RegisterProperty("lightcolor", color);
712 732
713 // Create light source uniforms on lighting shader. 733 // Create light source uniforms on lighting shader.
714 - char buffer[128];  
715 - char* writep = buffer + sprintf(buffer, "uLights[%d].", mNumLights); 734 + char buffer[LIGHT_SOURCE_BUFFER_SIZE];
  735 + char* writep = buffer + snprintf(buffer, LIGHT_SOURCE_BUFFER_SIZE, "uLights[%d].", mNumLights);
716 ++mNumLights; 736 ++mNumLights;
717 737
718 - strcpy(writep, "position"); 738 + strncpy(writep, POSITION_STRING.string, POSITION_STRING.size);
719 auto oPropLightPos = renderer.RegisterProperty(buffer, position); 739 auto oPropLightPos = renderer.RegisterProperty(buffer, position);
720 740
721 - strcpy(writep, "radius"); 741 + strncpy(writep, RADIUS_STRING.string, RADIUS_STRING.size);
722 auto oPropLightRadius = renderer.RegisterProperty(buffer, radius); 742 auto oPropLightRadius = renderer.RegisterProperty(buffer, radius);
723 743
724 - strcpy(writep, "color"); 744 + strncpy(writep, COLOR_STRING.string, COLOR_STRING.size);
725 auto oPropLightColor = renderer.RegisterProperty(buffer, color); 745 auto oPropLightColor = renderer.RegisterProperty(buffer, color);
726 746
727 // Constrain the light position, radius and color to lighting shader uniforms. 747 // Constrain the light position, radius and color to lighting shader uniforms.
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.9.2 5 +Version: 1.9.3
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0