diff --git a/GPU/Directx9/StateMappingDX9.cpp b/GPU/Directx9/StateMappingDX9.cpp index bd50e801f8..3ffa839563 100644 --- a/GPU/Directx9/StateMappingDX9.cpp +++ b/GPU/Directx9/StateMappingDX9.cpp @@ -94,7 +94,7 @@ static u32 blendColor2Func(u32 fix) { if (fix == 0) return D3DBLEND_ZERO; - Vec3f fix3 = Vec3f::FromRGB(fix); + const Vec3f fix3 = Vec3f::FromRGB(fix); if (fix3.x >= 0.99 && fix3.y >= 0.99 && fix3.z >= 0.99) return D3DBLEND_ONE; else if (fix3.x <= 0.01 && fix3.y <= 0.01 && fix3.z <= 0.01) @@ -102,8 +102,8 @@ static u32 blendColor2Func(u32 fix) { return D3DBLEND_UNK; } -static bool blendColorSimilar(Vec3f a, Vec3f b, float margin = 0.1f) { - Vec3f diff = a - b; +static bool blendColorSimilar(const Vec3f &a, const Vec3f &b, float margin = 0.1f) { + const Vec3f diff = a - b; if (fabsf(diff.x) <= margin && fabsf(diff.y) <= margin && fabsf(diff.z) <= margin) return true; return false; diff --git a/GPU/Directx9/TransformPipelineDX9.cpp b/GPU/Directx9/TransformPipelineDX9.cpp index d483e43bf4..d1512207be 100644 --- a/GPU/Directx9/TransformPipelineDX9.cpp +++ b/GPU/Directx9/TransformPipelineDX9.cpp @@ -138,7 +138,7 @@ using namespace DX9; class Lighter { public: Lighter(int vertType); - void Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], Vec3f pos, Vec3f normal); + void Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], const Vec3f &pos, const Vec3f &normal); private: Color4 globalAmbient; @@ -170,7 +170,7 @@ Lighter::Lighter(int vertType) { materialUpdate_ = hasColor ? gstate.materialupdate & 7 : 0; } -void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], Vec3f pos, Vec3f norm) +void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], const Vec3f &pos, const Vec3f &norm) { // Color are in dx format Color4 in; diff --git a/GPU/GLES/SoftwareTransform.cpp b/GPU/GLES/SoftwareTransform.cpp index 04a725adf2..2d50734fb2 100644 --- a/GPU/GLES/SoftwareTransform.cpp +++ b/GPU/GLES/SoftwareTransform.cpp @@ -53,7 +53,7 @@ inline float clamp(float in, float min, float max) { class Lighter { public: Lighter(int vertType); - void Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], Vec3f pos, Vec3f normal); + void Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], const Vec3f &pos, const Vec3f &normal); private: Color4 globalAmbient; @@ -85,7 +85,7 @@ Lighter::Lighter(int vertType) { materialUpdate_ = hasColor ? gstate.materialupdate & 7 : 0; } -void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], Vec3f pos, Vec3f norm) { +void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[4], const Vec3f &pos, const Vec3f &norm) { Color4 in(colorIn); const Color4 *ambient; diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index d2c14be7ce..0ae4a91016 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -148,7 +148,7 @@ static GLenum blendColor2Func(u32 fix) { if (fix == 0) return GL_ZERO; - Vec3f fix3 = Vec3f::FromRGB(fix); + const Vec3f fix3 = Vec3f::FromRGB(fix); if (fix3.x >= 0.99 && fix3.y >= 0.99 && fix3.z >= 0.99) return GL_ONE; else if (fix3.x <= 0.01 && fix3.y <= 0.01 && fix3.z <= 0.01) @@ -156,8 +156,8 @@ static GLenum blendColor2Func(u32 fix) { return GL_INVALID_ENUM; } -static bool blendColorSimilar(Vec3f a, Vec3f b, float margin = 0.1f) { - Vec3f diff = a - b; +static inline bool blendColorSimilar(const Vec3f &a, const Vec3f &b, float margin = 0.1f) { + const Vec3f diff = a - b; if (fabsf(diff.x) <= margin && fabsf(diff.y) <= margin && fabsf(diff.z) <= margin) return true; return false; diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 54f8a05365..acbff48e9c 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -714,7 +714,7 @@ static inline Vec4 GetTextureFunctionOutput(const Vec4& prim_color, co return Vec4(out_rgb.r(), out_rgb.g(), out_rgb.b(), out_a); } -static inline bool ColorTestPassed(Vec3 color) +static inline bool ColorTestPassed(const Vec3 &color) { const u32 mask = gstate.getColorTestMask(); const u32 c = color.ToRGB() & mask; @@ -874,7 +874,7 @@ static inline Vec3 GetDestFactor(const Vec4& source, const Vec4& } } -static inline Vec3 AlphaBlendingResult(const Vec4& source, const Vec4 dst) +static inline Vec3 AlphaBlendingResult(const Vec4 &source, const Vec4 &dst) { Vec3 srcfactor = GetSourceFactor(source, dst); Vec3 dstfactor = GetDestFactor(source, dst); @@ -935,7 +935,8 @@ static inline Vec3 AlphaBlendingResult(const Vec4& source, const Vec4< } template -inline void DrawSinglePixel(const DrawingCoords &p, u16 z, Vec4 prim_color) { +inline void DrawSinglePixel(const DrawingCoords &p, u16 z, const Vec4 &color_in) { + Vec4 prim_color = color_in; // Depth range test // TODO: Clear mode? if (!gstate.isModeThrough()) diff --git a/Windows/TouchInputHandler.cpp b/Windows/TouchInputHandler.cpp index 3037d09ed5..e7edca92ec 100644 --- a/Windows/TouchInputHandler.cpp +++ b/Windows/TouchInputHandler.cpp @@ -43,7 +43,7 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam, inputs, sizeof(TOUCHINPUT))) { - for (int i = 0; i < inputCount; i++) { + for (UINT i = 0; i < inputCount; i++) { int id = 0; //here we map the windows touch id to the ppsspp internal touch id @@ -64,7 +64,7 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam, } //finding first free internal touch id and map this windows id to an internal id bool *first_free = std::find(input_state.pointer_down, input_state.pointer_down + MAX_POINTERS, false); - id = (first_free - input_state.pointer_down) / sizeof(bool); + id = (int)(first_free - input_state.pointer_down) / (int)sizeof(bool); touchTranslate[inputs[i].dwID] = id; }