Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a25f4d83 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Clean unused parameters, disable warnings"

parents da5132c2 e63f7c62
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+3 −4
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -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;
+13 −16
Original line number Diff line number Diff line
@@ -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)) {
+6 −7
Original line number Diff line number Diff line
@@ -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
Loading