JavaScript plugin build fix for keyboard focus manager
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / basic / text-basic-renderer.cpp
index ac95892..52548d9 100644 (file)
 // CLASS HEADER
 #include <dali-toolkit/internal/text/rendering/basic/text-basic-renderer.h>
 
-// INTERNAL INCLUDES
-#include <dali/public-api/text-abstraction/font-client.h>
+// EXTERNAL INCLUDES
+#include <dali/devel-api/text-abstraction/font-client.h>
 #include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/actors/mesh-actor.h>
-#include <dali/public-api/images/atlas.h>
-#include <dali/public-api/geometry/mesh.h>
+#include <dali/devel-api/images/atlas.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/rendering/shaders/text-basic-shader.h>
+#include <dali-toolkit/internal/text/rendering/shaders/text-bgra-shader.h>
+
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -33,6 +37,10 @@ using namespace Dali::Toolkit::Text;
 namespace
 {
 
+#if defined(DEBUG_ENABLED)
+  Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
+#endif
+
 const std::size_t PADDING = 2; //< To avoid GL filtering artefacts
 
 struct TextureCoordinates
@@ -264,6 +272,7 @@ struct BasicRenderer::Impl
    * @param[in] positions The 2D positions of the glyphs.
    * @param[in] image The material uses this as a diffuse texture.
    */
+  /*
   Mesh CreateMesh( const Vector<GlyphInfo>& glyphs, const std::vector<Vector2>& positions, Pixel::Format format, Image image )
   {
     MeshData::VertexContainer vertices( 4 * glyphs.Count() ); // 1 quad per glyph
@@ -309,8 +318,8 @@ struct BasicRenderer::Impl
     Dali::Mesh mesh = Mesh::New( meshData );
     return mesh;
   }
-
-  RenderableActor mActor; ///< The actor which renders the text
+  */
+  Actor mActor; ///< The actor which renders the text
 
   Atlas mAtlasL8;
   unsigned int mWidthL8;
@@ -328,47 +337,54 @@ struct BasicRenderer::Impl
 
 Text::RendererPtr BasicRenderer::New()
 {
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::BasicRenderer::New()\n" );
+
   return Text::RendererPtr( new BasicRenderer() );
 }
 
-RenderableActor BasicRenderer::Render( Text::ViewInterface& view )
+Actor BasicRenderer::Render( Text::ViewInterface& view, unsigned int depth )
 {
   // Remove the previous text
   UnparentAndReset( mImpl->mActor );
 
-  Text::Length numberOfGlyphs = view.GetNumberOfGlyphs();
+  Length numberOfGlyphs = view.GetNumberOfGlyphs();
 
-  if( numberOfGlyphs > 0 )
+  if( numberOfGlyphs > 0u )
   {
     Vector<GlyphInfo> glyphs;
     glyphs.Resize( numberOfGlyphs );
 
-    view.GetGlyphs( &glyphs[0], 0, numberOfGlyphs );
-
     std::vector<Vector2> positions;
     positions.resize( numberOfGlyphs );
-    view.GetGlyphPositions( &positions[0], 0, numberOfGlyphs );
+
+    numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
+                                     &positions[0],
+                                     0u,
+                                     numberOfGlyphs );
+
+    glyphs.Resize( numberOfGlyphs );
+    positions.resize( numberOfGlyphs );
 
     mImpl->CreateAtlases( glyphs );
 
-    MeshActor actorL8;
+    Actor actorL8;
     if( mImpl->mAtlasL8 )
     {
-      actorL8 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::L8, mImpl->mAtlasL8 ) );
+      //actorL8 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::L8, mImpl->mAtlasL8 ) );
       actorL8.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
 
       ShaderEffect shader = BasicShader::New();
-      actorL8.SetShaderEffect( shader );
+      //actorL8.SetShaderEffect( shader );
     }
 
-    MeshActor actorBGRA8888;
+    Actor actorBGRA8888;
     if( mImpl->mAtlasBGRA8888 )
     {
-      actorBGRA8888 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::BGRA8888, mImpl->mAtlasBGRA8888 ) );
+      //actorBGRA8888 = MeshActor::New( mImpl->CreateMesh( glyphs, positions, Pixel::BGRA8888, mImpl->mAtlasBGRA8888 ) );
       actorBGRA8888.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
 
-      ShaderEffect shader = BasicShader::New();
-      actorBGRA8888.SetShaderEffect( shader );
+      ShaderEffect shader = BgraShader::New();
+      //actorBGRA8888.SetShaderEffect( shader );
     }
 
     // If we have both monochrome & color glyphs, two mesh actors are returned in a container