/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"ExtendInputEffectD2D1.h"
#include"Logging.h"
#include"ShadersD2D1.h" #include"HelpersD2D.h"
#include <vector>
#define TEXTW(x) L##x #define XML(X) \
TEXTW(#X) // This macro creates a single string from multiple lines of text.
staticconst PCWSTR kXmlDescription =
XML(
<?xml version='1.0'?>
<Effect>
<!-- System Properties -->
<Property name='DisplayName' type='string' value='ExtendInputEffect'/>
<Property name='Author' type='string' value='Mozilla'/>
<Property name='Category' type='string' value='Utility Effects'/>
<Property name='Description' type='string' value='This effect is used to extend the output rect of any input effect to a specified rect.'/>
<Inputs>
<Input name='InputEffect'/>
</Inputs>
<Property name='OutputRect' type='vector4'>
<Property name='DisplayName' type='string' value='Output Rect'/>
</Property>
</Effect>
);
static D2D1_RECT_L ConvertFloatToLongRect(const D2D1_VECTOR_4F& aRect) { // Clamp values to LONG range. We can't use std::min/max here because we want // the comparison to operate on a type that's different from the type of the // result. return D2D1::RectL(aRect.x <= float(LONG_MIN) ? LONG_MIN : LONG(aRect.x),
aRect.y <= float(LONG_MIN) ? LONG_MIN : LONG(aRect.y),
aRect.z >= float(LONG_MAX) ? LONG_MAX : LONG(aRect.z),
aRect.w >= float(LONG_MAX) ? LONG_MAX : LONG(aRect.w));
}
IFACEMETHODIMP
ExtendInputEffectD2D1::MapInputRectsToOutputRect( const D2D1_RECT_L* pInputRects, const D2D1_RECT_L* pInputOpaqueSubRects,
UINT32 inputRectCount, D2D1_RECT_L* pOutputRect,
D2D1_RECT_L* pOutputOpaqueSubRect) { // This transform only accepts one input, so there will only be one input // rect. if (inputRectCount != 1) { return E_INVALIDARG;
}
// Set the output rect to the specified rect. This is the whole purpose of // this effect.
*pOutputRect = ConvertFloatToLongRect(mOutputRect);
*pOutputOpaqueSubRect = IntersectRect(*pOutputRect, pInputOpaqueSubRects[0]); return S_OK;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.