From fa8250ba1215577ffb24aafbee6e18dbfb81f769 Mon Sep 17 00:00:00 2001 From: Peter Thoman Date: Fri, 3 May 2013 13:35:24 +0200 Subject: [PATCH] Avoid scaling empty and flat textures --- GPU/GLES/TextureScaler.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/GPU/GLES/TextureScaler.cpp b/GPU/GLES/TextureScaler.cpp index 036dea50a3..f810f55b3a 100644 --- a/GPU/GLES/TextureScaler.cpp +++ b/GPU/GLES/TextureScaler.cpp @@ -40,6 +40,8 @@ namespace p = std::placeholders; #include "native/base/timeutil.h" #endif +/////////////////////////////////////// Helper Functions (mostly math for parallelization) + namespace { // convert 4444 image to 8888, parallelizable void convert4444(u16* data, u32* out, int width, int l, int u) { @@ -261,11 +263,28 @@ namespace { } } +/////////////////////////////////////// Texture Scaler TextureScaler::TextureScaler() { } +bool TextureScaler::IsEmptyOrFlat(u32* data, int pixels, GLenum fmt) { + int pixelsPerWord = (fmt == GL_UNSIGNED_BYTE) ? 1 : 2; + int ref = data[0]; + for(int i=0; i