Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


edb6377

Member Since 21 Jul 2012
Offline Last Active Aug 11 2012 01:41 PM

Topics I've Started

DX7 VC++6 Slow Alpha Blending

06 August 2012 - 06:34 PM

Limitations: VC++ 6 and DX7

FPS = 60 (Dither)
FPS drops significantly when rendering Alpha Blended Text

Any Ideas?


Code as below.

Called to draw surface with Alpha Blend
   // Alpha mode
  
	DXDraw::RGBMASK mask = DXDraw::GetInstance()->GetRGBmask();
	DWORD r, g, b, color;

	// Render a alpha blended
	for( int y = rc.top; y < rc.bottom; y++ )
	{
	 for( int x = 0; x < rc.right; x++ )
	 {
	  color = pDestStart[ x ];
	  MergeColor( pimpl->backgroundColor, color );
	  pDestStart[ x ] = color;
	 }
	 pDestStart += pitch;
	}

Merge Color Code
// Add the color 1 with the second and divide the result by 2
#define MergeColor( clr1, clr2 )\
	r = ( ( clr1 & mask.rMask ) + ( clr2 & mask.rMask ) ) >> 1;\
	g = ( ( clr1 & mask.gMask ) + ( clr2 & mask.gMask ) ) >> 1;\
	b = ( ( clr1 & mask.bMask ) + ( clr2 & mask.bMask ) ) >> 1;\
color = ( r & mask.rMask ) | ( g & mask.gMask ) | ( b  & mask.bMask );

Change to Vector/Buffer Assignments?

21 July 2012 - 08:44 PM

So in this conversion this is the only other VC++ 6==>VC++ 2005 issue i keep running into

Worked in VC++ 6
[source lang="cpp"]//////////////////////////////////////////////////////////////////////////////////////////void Packet::GetBuffer//////////////////////////////////////////////////////////////////////////////////////////// Returns the packet's buffer and its size.// ( LPBYTE &lpNewBuffer, // The buffer to put the value to. int &nBufferSize // The size of the buffer.)//////////////////////////////////////////////////////////////////////////////////////////{ lpNewBuffer = vBuffer.begin(); nBufferSize = vBuffer.size();}[/source]

Now it returns the error

error C2440: '=' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'LPBYTE'
1> with
1> [
1> _Ty=BYTE,
1> _Alloc=std::allocator<BYTE>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Definition of LPBYTE
typedef BYTE far *LPBYTE;

Using the standard Vector.h from the VC includes.

I tried a few things like copy and what not.

AUTO_PTR issue.

21 July 2012 - 05:49 PM

I am having a heck of time converting this one piece of an old VS6 program to VS2005

Error 161 error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit' C:\Program Files\Microsoft Visual Studio 8\VC\include\utility 37
Error 230 error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit' C:\Program Files\Microsoft Visual Studio 8\VC\include\vector 1125
Error 256 error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit' C:\Program Files\Microsoft Visual Studio 8\VC\include\utility 37

Header: (Added // ERROR IS HERE where its breaking)
[source lang="cpp"]// utility standard header#pragma once#ifndef _UTILITY_#define _UTILITY_#ifndef RC_INVOKED#include <iosfwd>#ifdef _MSC_VER#pragma pack(push,_CRT_PACKING)#pragma warning(push,3)#endif /* _MSC_VER */_STD_BEGIN // TEMPLATE FUNCTION swap (from <algorithm>)template<class _Ty> inline void swap(_Ty& _Left, _Ty& _Right) { // exchange values stored at _Left and _Right _Ty _Tmp = _Left; _Left = _Right, _Right = _Tmp; } // TEMPLATE STRUCT pairtemplate<class _Ty1, class _Ty2> struct pair { // store a pair of values typedef pair<_Ty1, _Ty2> _Myt; typedef _Ty1 first_type; typedef _Ty2 second_type; pair() : first(_Ty1()), second(_Ty2()) { // construct from defaults } pair(const _Ty1& _Val1, const _Ty2& _Val2) : first(_Val1), second(_Val2) { // construct from specified values// ERROR IS HERE } template<class _Other1, class _Other2> pair(const pair<_Other1, _Other2>& _Right) : first(_Right.first), second(_Right.second) { // construct from compatible pair } void swap(_Myt& _Right) { // exchange contents with _Right std::swap(first, _Right.first); std::swap(second, _Right.second); } _Ty1 first; // the first stored value _Ty2 second; // the second stored value }; // pair TEMPLATE FUNCTIONStemplate<class _Ty1, class _Ty2> inline bool operator==(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test for pair equality return (_Left.first == _Right.first && _Left.second == _Right.second); }template<class _Ty1, class _Ty2> inline bool operator!=(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test for pair inequality return (!(_Left == _Right)); }template<class _Ty1, class _Ty2> inline bool operator<(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test if _Left < _Right for pairs return (_Left.first < _Right.first || !(_Right.first < _Left.first) && _Left.second < _Right.second); }template<class _Ty1, class _Ty2> inline bool operator>(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test if _Left > _Right for pairs return (_Right < _Left); }template<class _Ty1, class _Ty2> inline bool operator<=(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test if _Left <= _Right for pairs return (!(_Right < _Left)); }template<class _Ty1, class _Ty2> inline bool operator>=(const pair<_Ty1, _Ty2>& _Left, const pair<_Ty1, _Ty2>& _Right) { // test if _Left >= _Right for pairs return (!(_Left < _Right)); }template<class _Ty1, class _Ty2> inline pair<_Ty1, _Ty2> make_pair(_Ty1 _Val1, _Ty2 _Val2) { // return pair composed from arguments return (pair<_Ty1, _Ty2>(_Val1, _Val2)); }template<class _Ty1, class _Ty2> inline void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>& _Right) { // swap _Left and _Right pairs _Left.swap(_Right); } // TEMPLATE OPERATORS namespace rel_ops { // nested namespace to hide relational operators from stdtemplate<class _Ty> inline bool operator!=(const _Ty& _Left, const _Ty& _Right) { // test for inequality, in terms of equality return (!(_Left == _Right)); }template<class _Ty> inline bool operator>(const _Ty& _Left, const _Ty& _Right) { // test if _Left > _Right, in terms of operator< return (_Right < _Left); }template<class _Ty> inline bool operator<=(const _Ty& _Left, const _Ty& _Right) { // test if _Left <= _Right, in terms of operator< return (!(_Right < _Left)); }template<class _Ty> inline bool operator>=(const _Ty& _Left, const _Ty& _Right) { // test if _Left >= _Right, in terms of operator< return (!(_Left < _Right)); } }_STD_END#ifdef _MSC_VER#pragma warning(pop)#pragma pack(pop)#endif /* _MSC_VER */#endif /* RC_INVOKED */#endif /* _UTILITY_ *//** Copyright © 1992-2005 by P.J. Plauger. ALL RIGHTS RESERVED.* Consult your license regarding permissions and restrictions.*//** This file is derived from software bearing the following* restrictions:** Copyright © 1994* Hewlett-Packard Company** Permission to use, copy, modify, distribute and sell this* software and its documentation for any purpose is hereby* granted without fee, provided that the above copyright notice* appear in all copies and that both that copyright notice and* this permission notice appear in supporting documentation.* Hewlett-Packard Company makes no representations about the* suitability of this software for any purpose. It is provided* "as is" without express or implied warranty.V4.05:0009 */[/source]

PARTNERS