return mImpl->mModel->mVisualModel->GetBackgroundColorWithCutout();
}
+void Controller::SetOffsetWithCutout(const Vector2& offset)
+{
+ mImpl->mModel->mVisualModel->SetOffsetWithCutout(offset);
+}
+
Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection)
{
return Relayouter::Relayout(*this, size, layoutDirection);
*/
const Vector4 GetBackgroundColorWithCutout() const;
+ /**
+ * @brief Sets offset with cutout.
+ *
+ * @param[in] offset The offset.
+ */
+ void SetOffsetWithCutout(const Vector2& offset);
+
public: // Queries & retrieves.
/**
* @brief Return the layout engine.
}
}
+ const bool isCutoutEnabled = mModel->IsCutoutEnabled();
+ if(isCutoutEnabled)
+ {
+ Vector2 offset = mModel->GetOffsetWithCutout();
+ penX += offset.x;
+ penY += offset.y;
+ }
+
// Generate the image buffers of the text for each different style first,
// then combine all of them together as one final image buffer. We try to
// do all of these in CPU only, so that once the final texture is generated,
return mModel->GetBackgroundColorWithCutout();
}
+const Vector2& ViewModel::GetOffsetWithCutout() const
+{
+ return mModel->GetOffsetWithCutout();
+}
+
} // namespace Text
} // namespace Toolkit
*/
const Vector4& GetBackgroundColorWithCutout() const override;
+ /**
+ * @copydoc ModelInterface::GetOffsetWithCutout()
+ */
+ const Vector2& GetOffsetWithCutout() const override;
+
private:
const ModelInterface* const mModel; ///< Pointer to the text's model.
Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
* @return The color of the background with cutout.
*/
virtual const Vector4& GetBackgroundColorWithCutout() const = 0;
+
+ /**
+ * @brief Retrieves the left and top offset with cutout.
+ *
+ * @return The offset with cutout.
+ */
+ virtual const Vector2& GetOffsetWithCutout() const = 0;
};
} // namespace Text
return mVisualModel->GetBackgroundColorWithCutout();
}
+const Vector2& Model::GetOffsetWithCutout() const
+{
+ return mVisualModel->GetOffsetWithCutout();
+}
+
Model::Model()
: mLogicalModel(),
mVisualModel(),
*/
const Vector4& GetBackgroundColorWithCutout() const override;
+ /**
+ * @copydoc ModelInterface::GetOffsetWithCutout()
+ */
+ const Vector2& GetOffsetWithCutout() const override;
+
private: // Private contructors & copy operator.
/**
* @brief Private constructor.
return mBackgroundColorWithCutout;
}
+void VisualModel::SetOffsetWithCutout(const Vector2& offset)
+{
+ mOffsetWithCutout = offset;
+}
+
+const Vector2& VisualModel::GetOffsetWithCutout() const
+{
+ return mOffsetWithCutout;
+}
+
VisualModel::~VisualModel()
{
}
*/
const Vector4& GetBackgroundColorWithCutout() const;
+ /**
+ * @brief Sets the left and top offset with cutout.
+ *
+ * @param[in] offset The offset to set.
+ */
+ void SetOffsetWithCutout(const Vector2& offset);
+
+ /**
+ * @brief Retrieves the left and top offset with cutout.
+ *
+ * @return The offset.
+ */
+ const Vector2& GetOffsetWithCutout() const;
+
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
float mDashedUnderlineWidth; ///< The width of the dashes of the dashed underline.
float mDashedUnderlineGap; ///< The gap between the dashes of the dashed underline.
float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
- float mOutlineBlurRadius; ///< Blur radius of outline, 0 indicates no blur.
+ float mOutlineBlurRadius; ///< Blur radius of outline, 0 indicates no blur.
uint16_t mOutlineWidth; ///< Width of outline.
Vector<StrikethroughGlyphRun> mStrikethroughRuns; ///< Runs of glyphs that have strikethrough.
Vector<CharacterSpacingGlyphRun> mCharacterSpacingRuns; ///< Runs of glyphs that have character-spacing.
Vector4 mBackgroundColorWithCutout; ///< Background color with cutout.
+ Vector2 mOffsetWithCutout; ///< Left and top offset when cutout.
private:
Size mNaturalSize; ///< Size of the text with no line wrapping.
if(cutoutEnabled)
{
- relayoutSize = Vector2(controlWidth, controlHeight);
- mImpl->mTransform.mSize.width = controlWidth;
+ // mTransform stores the size and offset of the current visual.
+ // padding and alignment information is stored in mOffset.
+ // When Cutout Enabled, the current visual must draw the entire control.
+ // so set the size to controlSize and offset to 0.
+
+ relayoutSize = Vector2(controlWidth, controlHeight);
+ mImpl->mTransform.mSize.width = controlWidth;
mImpl->mTransform.mSize.height = controlHeight;
- mImpl->mTransform.mOffset.x = 0;
- mImpl->mTransform.mOffset.y = 0;
+
+ // Relayout to the original size has been completed, so save only the offset information and use it in typesetter.
+
+ Vector2 originOffset = Vector2(mImpl->mTransform.mOffset.x, mImpl->mTransform.mOffset.y);
+ mController->SetOffsetWithCutout(originOffset);
+ mImpl->mTransform.mOffset.x = 0;
+ mImpl->mTransform.mOffset.y = 0;
}
AddRenderer(control, relayoutSize, hasMultipleTextColors, containsColorGlyph, styleEnabled, isOverlayStyle);