Clean unused parameters, disable warnings

Change-Id: Iddb872f53075dd022eeef45265594d1c6a9e2bc0
This commit is contained in:
Chris Craik
2013-10-17 10:30:55 -07:00
parent 8c317898ee
commit e63f7c622a
12 changed files with 37 additions and 40 deletions

View File

@@ -58,6 +58,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
external/skia/include/utils
LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += -Wno-unused-parameter
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui
LOCAL_MODULE := libhwui

View File

@@ -115,7 +115,7 @@ void GradientCache::setMaxSize(uint32_t maxSize) {
// Callbacks
///////////////////////////////////////////////////////////////////////////////
void GradientCache::operator()(GradientCacheEntry& shader, Texture*& texture) {
void GradientCache::operator()(GradientCacheEntry&, Texture*& texture) {
if (texture) {
const uint32_t size = texture->width * texture->height * bytesPerPixel();
mSize -= size;
@@ -185,7 +185,7 @@ Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
mCache.removeOldest();
}
generateTexture(colors, positions, count, texture);
generateTexture(colors, positions, texture);
mSize += size;
mCache.put(gradient, texture);
@@ -238,8 +238,7 @@ void GradientCache::mixFloats(GradientColor& start, GradientColor& end, float am
dst += 4 * sizeof(float);
}
void GradientCache::generateTexture(uint32_t* colors, float* positions,
int count, Texture* texture) {
void GradientCache::generateTexture(uint32_t* colors, float* positions, Texture* texture) {
const uint32_t width = texture->width;
const GLsizei rowBytes = width * bytesPerPixel();
uint8_t pixels[rowBytes * texture->height];

View File

@@ -151,7 +151,7 @@ private:
Texture* addLinearGradient(GradientCacheEntry& gradient,
uint32_t* colors, float* positions, int count);
void generateTexture(uint32_t* colors, float* positions, int count, Texture* texture);
void generateTexture(uint32_t* colors, float* positions, Texture* texture);
struct GradientInfo {
uint32_t width;

View File

@@ -779,11 +779,10 @@ bool OpenGLRenderer::restoreSnapshot() {
int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom,
int alpha, SkXfermode::Mode mode, int flags) {
const GLuint previousFbo = mSnapshot->fbo;
const int count = saveSnapshot(flags);
if (!mSnapshot->isIgnored()) {
createLayer(left, top, right, bottom, alpha, mode, flags, previousFbo);
createLayer(left, top, right, bottom, alpha, mode, flags);
}
return count;
@@ -835,7 +834,6 @@ void OpenGLRenderer::updateSnapshotIgnoreForLayer(const Rect& bounds, const Rect
int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float bottom,
int alpha, SkXfermode::Mode mode, int flags) {
const GLuint previousFbo = mSnapshot->fbo;
const int count = saveSnapshot(flags);
if (!mSnapshot->isIgnored() && (flags & SkCanvas::kClipToLayer_SaveFlag)) {
@@ -911,7 +909,7 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float
* something actually gets drawn are the layers regions cleared.
*/
bool OpenGLRenderer::createLayer(float left, float top, float right, float bottom,
int alpha, SkXfermode::Mode mode, int flags, GLuint previousFbo) {
int alpha, SkXfermode::Mode mode, int flags) {
LAYER_LOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
LAYER_LOGD("Layer cache size = %d", mCaches.layerCache.getSize());
@@ -948,7 +946,7 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto
startMark("SaveLayer");
if (fboLayer) {
return createFboLayer(layer, bounds, clip, previousFbo);
return createFboLayer(layer, bounds, clip);
} else {
// Copy the framebuffer into the layer
layer->bindTexture();
@@ -974,7 +972,7 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto
return true;
}
bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip, GLuint previousFbo) {
bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip) {
layer->clipRect.set(clip);
layer->setFbo(mCaches.fboCache.get());
@@ -1268,15 +1266,15 @@ void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) {
}
#if DEBUG_LAYERS_AS_REGIONS
drawRegionRects(layer->region);
drawRegionRectsDebug(layer->region);
#endif
layer->region.clear();
}
}
void OpenGLRenderer::drawRegionRects(const Region& region) {
#if DEBUG_LAYERS_AS_REGIONS
void OpenGLRenderer::drawRegionRectsDebug(const Region& region) {
size_t count;
const android::Rect* rects = region.getArray(&count);
@@ -1298,8 +1296,8 @@ void OpenGLRenderer::drawRegionRects(const Region& region) {
drawColorRect(r.left, r.top, r.right, r.bottom, colors[offset + (i & 0x1)],
SkXfermode::kSrcOver_Mode);
}
#endif
}
#endif
void OpenGLRenderer::drawRegionRects(const SkRegion& region, int color,
SkXfermode::Mode mode, bool dirty) {
@@ -1792,7 +1790,7 @@ void OpenGLRenderer::setupDrawColor(int color, int alpha) {
mColorG = mColorA * ((color >> 8) & 0xFF) / 255.0f;
mColorB = mColorA * ((color ) & 0xFF) / 255.0f;
mColorSet = true;
mSetShaderColor = mDescription.setColor(mColorR, mColorG, mColorB, mColorA);
mSetShaderColor = mDescription.setColorModulate(mColorA);
}
void OpenGLRenderer::setupDrawAlpha8Color(int color, int alpha) {
@@ -1801,7 +1799,7 @@ void OpenGLRenderer::setupDrawAlpha8Color(int color, int alpha) {
mColorG = mColorA * ((color >> 8) & 0xFF) / 255.0f;
mColorB = mColorA * ((color ) & 0xFF) / 255.0f;
mColorSet = true;
mSetShaderColor = mDescription.setAlpha8Color(mColorR, mColorG, mColorB, mColorA);
mSetShaderColor = mDescription.setAlpha8ColorModulate(mColorR, mColorG, mColorB, mColorA);
}
void OpenGLRenderer::setupDrawTextGamma(const SkPaint* paint) {
@@ -1814,7 +1812,7 @@ void OpenGLRenderer::setupDrawColor(float r, float g, float b, float a) {
mColorG = g;
mColorB = b;
mColorSet = true;
mSetShaderColor = mDescription.setColor(r, g, b, a);
mSetShaderColor = mDescription.setColorModulate(a);
}
void OpenGLRenderer::setupDrawShader() {
@@ -2998,7 +2996,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, f
dirtyLayerUnchecked(layerBounds, getRegion());
}
drawTextDecorations(text, bytesCount, totalAdvance, oldX, oldY, paint);
drawTextDecorations(totalAdvance, oldX, oldY, paint);
return DrawGlInfo::kStatusDrew;
}
@@ -3132,7 +3130,7 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y) {
}
#if DEBUG_LAYERS_AS_REGIONS
drawRegionRects(layer->region);
drawRegionRectsDebug(layer->region);
#endif
}
@@ -3272,8 +3270,7 @@ void OpenGLRenderer::drawPathTexture(const PathTexture* texture,
#define kStdUnderline_Offset (1.0f / 9.0f)
#define kStdUnderline_Thickness (1.0f / 18.0f)
void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float underlineWidth,
float x, float y, SkPaint* paint) {
void OpenGLRenderer::drawTextDecorations(float underlineWidth, float x, float y, SkPaint* paint) {
// Handle underline and strike-through
uint32_t flags = paint->getFlags();
if (flags & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag)) {

View File

@@ -654,12 +654,11 @@ private:
* @param alpha The translucency of the layer
* @param mode The blending mode of the layer
* @param flags The layer save flags
* @param previousFbo The name of the current framebuffer
*
* @return True if the layer was successfully created, false otherwise
*/
bool createLayer(float left, float top, float right, float bottom,
int alpha, SkXfermode::Mode mode, int flags, GLuint previousFbo);
int alpha, SkXfermode::Mode mode, int flags);
/**
* Creates a new layer stored in the specified snapshot as an FBO.
@@ -667,9 +666,8 @@ private:
* @param layer The layer to store as an FBO
* @param snapshot The snapshot associated with the new layer
* @param bounds The bounds of the layer
* @param previousFbo The name of the current framebuffer
*/
bool createFboLayer(Layer* layer, Rect& bounds, Rect& clip, GLuint previousFbo);
bool createFboLayer(Layer* layer, Rect& bounds, Rect& clip);
/**
* Compose the specified layer as a region.
@@ -868,8 +866,7 @@ private:
* @param y The y coordinate where the text will be drawn
* @param paint The paint to draw the text with
*/
void drawTextDecorations(const char* text, int bytesCount, float totalAdvance,
float x, float y, SkPaint* paint);
void drawTextDecorations(float totalAdvance, float x, float y, SkPaint* paint);
/**
* Draws shadow layer on text (with optional positions).
@@ -1004,11 +1001,13 @@ private:
void updateLayers();
void flushLayers();
#if DEBUG_LAYERS_AS_REGIONS
/**
* Renders the specified region as a series of rectangles. This method
* is used for debugging only.
*/
void drawRegionRects(const Region& region);
void drawRegionRectsDebug(const Region& region);
#endif
/**
* Renders the specified region as a series of rectangles. The region

View File

@@ -207,7 +207,7 @@ struct ProgramDescription {
* the fragment shader. When this method returns true, the program should
* be provided with a modulation color.
*/
bool setColor(const float r, const float g, const float b, const float a) {
bool setColorModulate(const float a) {
modulate = a < COLOR_COMPONENT_THRESHOLD;
return modulate;
}
@@ -217,7 +217,7 @@ struct ProgramDescription {
* the fragment shader. When this method returns true, the program should
* be provided with a modulation color.
*/
bool setAlpha8Color(const float r, const float g, const float b, const float a) {
bool setAlpha8ColorModulate(const float r, const float g, const float b, const float a) {
modulate = a < COLOR_COMPONENT_THRESHOLD || r > COLOR_COMPONENT_INV_THRESHOLD ||
g > COLOR_COMPONENT_INV_THRESHOLD || b > COLOR_COMPONENT_INV_THRESHOLD;
return modulate;

View File

@@ -142,7 +142,7 @@ void SkiaBitmapShader::describe(ProgramDescription& description, const Extension
}
void SkiaBitmapShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
const Snapshot&, GLuint* textureUnit) {
GLuint textureSlot = (*textureUnit)++;
Caches::getInstance().activeTexture(textureSlot);
@@ -228,7 +228,7 @@ void SkiaLinearGradientShader::describe(ProgramDescription& description,
}
void SkiaLinearGradientShader::setupProgram(Program* program, const mat4& modelView,
const Snapshot& snapshot, GLuint* textureUnit) {
const Snapshot&, GLuint* textureUnit) {
if (CC_UNLIKELY(!mIsSimple)) {
GLuint textureSlot = (*textureUnit)++;
Caches::getInstance().activeTexture(textureSlot);
@@ -264,7 +264,7 @@ static void toCircularUnitMatrix(const float x, const float y, const float radiu
SkiaCircularGradientShader::SkiaCircularGradientShader(float x, float y, float radius,
uint32_t* colors, float* positions, int count, SkShader* key, SkShader::TileMode tileMode,
SkMatrix* matrix, bool blend):
SkiaSweepGradientShader(kCircularGradient, x, y, colors, positions, count, key,
SkiaSweepGradientShader(kCircularGradient, colors, positions, count, key,
tileMode, matrix, blend) {
SkMatrix unitMatrix;
toCircularUnitMatrix(x, y, radius, &unitMatrix);
@@ -314,11 +314,12 @@ SkiaSweepGradientShader::SkiaSweepGradientShader(float x, float y, uint32_t* col
mIsSimple = count == 2;
}
SkiaSweepGradientShader::SkiaSweepGradientShader(Type type, float x, float y, uint32_t* colors,
SkiaSweepGradientShader::SkiaSweepGradientShader(Type type, uint32_t* colors,
float* positions, int count, SkShader* key, SkShader::TileMode tileMode,
SkMatrix* matrix, bool blend):
SkiaShader(type, key, tileMode, tileMode, matrix, blend),
mColors(colors), mPositions(positions), mCount(count) {
// protected method, that doesn't setup mUnitMatrix - should be handled by subclass
mIsSimple = count == 2 && tileMode == SkShader::kClamp_TileMode;
}

View File

@@ -192,7 +192,7 @@ struct SkiaSweepGradientShader: public SkiaShader {
GLuint* textureUnit);
protected:
SkiaSweepGradientShader(Type type, float x, float y, uint32_t* colors, float* positions,
SkiaSweepGradientShader(Type type, uint32_t* colors, float* positions,
int count, SkShader* key, SkShader::TileMode tileMode, SkMatrix* matrix, bool blend);
SkiaSweepGradientShader() {
}

View File

@@ -147,7 +147,7 @@ void TextDropShadowCache::setMaxSize(uint32_t maxSize) {
// Callbacks
///////////////////////////////////////////////////////////////////////////////
void TextDropShadowCache::operator()(ShadowText& text, ShadowTexture*& texture) {
void TextDropShadowCache::operator()(ShadowText&, ShadowTexture*& texture) {
if (texture) {
mSize -= texture->bitmapSize;

View File

@@ -103,7 +103,7 @@ void TextureCache::setFlushRate(float flushRate) {
// Callbacks
///////////////////////////////////////////////////////////////////////////////
void TextureCache::operator()(SkBitmap*& bitmap, Texture*& texture) {
void TextureCache::operator()(SkBitmap*&, Texture*& texture) {
// This will be called already locked
if (texture) {
mSize -= texture->bitmapSize;

View File

@@ -114,7 +114,7 @@ CacheTexture::CacheTexture(uint16_t width, uint16_t height, GLenum format, uint3
mMesh(NULL), mCurrentQuad(0), mMaxQuadCount(maxQuadCount),
mCaches(Caches::getInstance()) {
mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE);
// OpenGL ES 3.0+ lets us specify the row length for unpack operations such
// as glTexSubImage2D(). This allows us to upload a sub-rectangle of a texture.
@@ -143,7 +143,7 @@ void CacheTexture::init() {
// reset, then create a new remainder space to start again
reset();
mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE);
}
void CacheTexture::releaseMesh() {

View File

@@ -54,7 +54,7 @@ struct CacheBlock {
CacheBlock* mNext;
CacheBlock* mPrev;
CacheBlock(uint16_t x, uint16_t y, uint16_t width, uint16_t height, bool empty = false):
CacheBlock(uint16_t x, uint16_t y, uint16_t width, uint16_t height):
mX(x), mY(y), mWidth(width), mHeight(height), mNext(NULL), mPrev(NULL) {
}