共用方式為


D1111:當裁剪足夠時使用圖層

PERF - 圖層正與 Null 不透明度遮罩、1.0 不透明度和軸對齊的矩形幾何遮罩搭配使用。 推送/快顯剪輯 API 應該達到具有相同效能的結果。

預留位置

介面

介面的位址。

   
錯誤層級 資訊

 

範例

當圖層只包含一個基本 () 矩形時,下列程式碼會使用 PushLayerPopLayer ,而 D2D1_LAYER_PARAMETERS 結構的欄位會設定為預設值。 如需 D2D1_LAYER_PARAMETERS 結構的預設值,請參閱 LayerParameter

        ID2D1Layer *m_pLayer;

        hr = m_pRenderTarget->CreateLayer(D2D1::SizeF(100, 100), &m_pLayer);
        m_pRenderTarget->PushLayer(D2D1::LayerParameters(), m_pLayer);
        m_pRenderTarget->FillRectangle(D2D1::RectF(100, 50, 400, 160), m_pBlackBrush);
        m_pRenderTarget->PopLayer();

此範例會產生下列偵錯訊息:

DEBUG INFO - PERF - A layer is being used with a NULL opacity mask, 1.0 opacity, 
            and an axis aligned rectangular geometric mask.  
            The Push/Pop Clip API should achieve the same results with higher performance.

可能的原因

當 PushAxisAlignedClipPopAxisAlignedClip方法已足夠時,就會使用圖層。