Ejemplo n.º 1
0
CFDictionaryRef QTPixelBuffer::createPixelBufferAttributesDictionary(QTPixelBuffer::Type contextType)
{
    static const CFStringRef kDirect3DCompatibilityKey = CFSTR("Direct3DCompatibility");

    CFMutableDictionaryRef pixelBufferAttributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
    if (contextType == QTPixelBuffer::ConfigureForCAImageQueue) {
        // Ask for D3D compatible pixel buffers so no further work is needed.
        CFDictionarySetValue(pixelBufferAttributes, kDirect3DCompatibilityKey, kCFBooleanTrue);
    } else {
        // Use the k32BGRAPixelFormat, as QuartzCore will be able to use the pixels directly,
        // without needing an additional copy or rendering pass.
        SetNumberValue(pixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey, k32BGRAPixelFormat);
            
        // Set kCVPixelBufferBytesPerRowAlignmentKey to 16 to ensure that each row of pixels 
        // starts at a 16 byte aligned address for most efficient data reading.
        SetNumberValue(pixelBufferAttributes, kCVPixelBufferBytesPerRowAlignmentKey, 16);
        CFDictionarySetValue(pixelBufferAttributes, kCVPixelBufferCGImageCompatibilityKey, kCFBooleanTrue);
    }
    return pixelBufferAttributes;
}
Ejemplo n.º 2
0
void OpNumberEdit::ChangeNumber(int direction)
{
	OP_ASSERT(direction != 0);
	double delta = direction * m_step;
	double value_number;
	if (HasValue() && GetValue(value_number))
	{
		value_number = WebForms2Number::SnapToStep(value_number, m_step_base, m_step, direction);
		double result_value;
		OP_STATUS status =
			WebForms2Number::StepNumber(value_number, m_min_value,
										m_max_value, m_step_base,
										m_step, direction, m_wrap_around,
										TRUE, /* fuzzy step, be helpful. */
										result_value);
		if (OpStatus::IsSuccess(status))
		{
			SetNumberValue(result_value);
		}
	}
	else if (m_wrap_around)
	{
		// If we have a wrappable number control and the user
		// clicks up or down, start the number even if there was none from the beginning.
		double value_number = delta >= 0 ? m_min_value : m_max_value;
		SetNumberValue(value_number);
	}
	else
	{
		// Not wrap around and no current content.
		if (m_min_value > m_max_value)
		{
			return;
		}
		if (delta >= 0)
		{
			// some low value
			if (m_min_value != -DBL_MAX)
			{
				SetNumberValue(m_min_value);
			}
			else if (m_max_value >= 0.0)
			{
				SetNumberValue(0.0);
			}
			else
			{
				SetNumberValue(m_max_value); // What else? -DBL_MAX?
			}
		}
		else
		{
			// some high value
			if (m_max_value != DBL_MAX)
			{
				SetNumberValue(m_max_value);
			}
			else if (m_min_value <= 0.0)
			{
				SetNumberValue(0.0);
			}
			else
			{
				SetNumberValue(m_min_value); // What else? DBL_MAX?
			}
		}
	}

	if (listener)
	{
		listener->OnChangeWhenLostFocus(this); // since normal OnChange is filtered
	}
}