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

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

Merge "Move scissor state to RenderState"

parents 5f54ecbe 65fe5eeb
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -5,12 +5,21 @@ LOCAL_CLANG_CFLAGS += \
    -Wno-gnu-static-float-init

LOCAL_SRC_FILES := \
    font/CacheTexture.cpp \
    font/Font.cpp \
    renderstate/RenderState.cpp \
    renderstate/Scissor.cpp \
    renderthread/CanvasContext.cpp \
    renderthread/DrawFrameTask.cpp \
    renderthread/EglManager.cpp \
    renderthread/RenderProxy.cpp \
    renderthread/RenderTask.cpp \
    renderthread/RenderThread.cpp \
    renderthread/TimeLord.cpp \
    thread/TaskManager.cpp \
    utils/Blur.cpp \
    utils/GLUtils.cpp \
    utils/SortedListImpl.cpp \
    thread/TaskManager.cpp \
    font/CacheTexture.cpp \
    font/Font.cpp \
    AmbientShadow.cpp \
    AnimationContext.cpp \
    Animator.cpp \
@@ -48,7 +57,6 @@ LOCAL_SRC_FILES := \
    RenderBufferCache.cpp \
    RenderNode.cpp \
    RenderProperties.cpp \
    RenderState.cpp \
    ResourceCache.cpp \
    ShadowTessellator.cpp \
    SkiaCanvas.cpp \
@@ -61,16 +69,6 @@ LOCAL_SRC_FILES := \
    TextureCache.cpp \
    TextDropShadowCache.cpp

# RenderThread stuff
LOCAL_SRC_FILES += \
    renderthread/CanvasContext.cpp \
    renderthread/DrawFrameTask.cpp \
    renderthread/EglManager.cpp \
    renderthread/RenderProxy.cpp \
    renderthread/RenderTask.cpp \
    renderthread/RenderThread.cpp \
    renderthread/TimeLord.cpp

intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)

LOCAL_C_INCLUDES += \
+6 −74
Original line number Diff line number Diff line
@@ -16,16 +16,17 @@

#define LOG_TAG "OpenGLRenderer"

#include <utils/Log.h>
#include <utils/String8.h>

#include "Caches.h"

#include "DisplayListRenderer.h"
#include "GammaFontRenderer.h"
#include "Properties.h"
#include "LayerRenderer.h"
#include "Properties.h"
#include "renderstate/RenderState.h"
#include "ShadowTessellator.h"
#include "RenderState.h"

#include <utils/Log.h>
#include <utils/String8.h>

namespace android {

@@ -80,10 +81,6 @@ bool Caches::init() {

    mTexCoordsArrayEnabled = false;

    glDisable(GL_SCISSOR_TEST);
    scissorEnabled = false;
    mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;

    glActiveTexture(gTextureUnits[0]);
    mTextureUnit = 0;

@@ -578,71 +575,6 @@ void Caches::unbindTexture(GLuint texture) {
    }
}

///////////////////////////////////////////////////////////////////////////////
// Scissor
///////////////////////////////////////////////////////////////////////////////

bool Caches::setScissor(GLint x, GLint y, GLint width, GLint height) {
    if (scissorEnabled && (x != mScissorX || y != mScissorY ||
            width != mScissorWidth || height != mScissorHeight)) {

        if (x < 0) {
            width += x;
            x = 0;
        }
        if (y < 0) {
            height += y;
            y = 0;
        }
        if (width < 0) {
            width = 0;
        }
        if (height < 0) {
            height = 0;
        }
        glScissor(x, y, width, height);

        mScissorX = x;
        mScissorY = y;
        mScissorWidth = width;
        mScissorHeight = height;

        return true;
    }
    return false;
}

bool Caches::enableScissor() {
    if (!scissorEnabled) {
        glEnable(GL_SCISSOR_TEST);
        scissorEnabled = true;
        resetScissor();
        return true;
    }
    return false;
}

bool Caches::disableScissor() {
    if (scissorEnabled) {
        glDisable(GL_SCISSOR_TEST);
        scissorEnabled = false;
        return true;
    }
    return false;
}

void Caches::setScissorEnabled(bool enabled) {
    if (scissorEnabled != enabled) {
        if (enabled) glEnable(GL_SCISSOR_TEST);
        else glDisable(GL_SCISSOR_TEST);
        scissorEnabled = enabled;
    }
}

void Caches::resetScissor() {
    mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
}

///////////////////////////////////////////////////////////////////////////////
// Tiling
///////////////////////////////////////////////////////////////////////////////
+0 −20
Original line number Diff line number Diff line
@@ -272,20 +272,6 @@ public:
     */
    void unbindTexture(GLuint texture);

    /**
     * Sets the scissor for the current surface.
     */
    bool setScissor(GLint x, GLint y, GLint width, GLint height);

    /**
     * Resets the scissor state.
     */
    void resetScissor();

    bool enableScissor();
    bool disableScissor();
    void setScissorEnabled(bool enabled);

    void startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool discard);
    void endTiling();

@@ -310,7 +296,6 @@ public:
    GLenum lastSrcMode;
    GLenum lastDstMode;
    Program* currentProgram;
    bool scissorEnabled;

    bool drawDeferDisabled;
    bool drawReorderDisabled;
@@ -408,11 +393,6 @@ private:

    GLuint mTextureUnit;

    GLint mScissorX;
    GLint mScissorY;
    GLint mScissorWidth;
    GLint mScissorHeight;

    Extensions& mExtensions;

    // Used to render layers
+8 −8
Original line number Diff line number Diff line
@@ -17,13 +17,6 @@
#ifndef ANDROID_HWUI_DISPLAY_OPERATION_H
#define ANDROID_HWUI_DISPLAY_OPERATION_H

#include <SkColor.h>
#include <SkPath.h>
#include <SkPathOps.h>
#include <SkXfermode.h>

#include <private/hwui/DrawGlInfo.h>

#include "OpenGLRenderer.h"
#include "AssetAtlas.h"
#include "DeferredDisplayList.h"
@@ -31,11 +24,18 @@
#include "GammaFontRenderer.h"
#include "Patch.h"
#include "RenderNode.h"
#include "RenderState.h"
#include "renderstate/RenderState.h"
#include "UvMapper.h"
#include "utils/LinearAllocator.h"
#include "utils/PaintUtils.h"

#include <SkColor.h>
#include <SkPath.h>
#include <SkPathOps.h>
#include <SkXfermode.h>

#include <private/hwui/DrawGlInfo.h>

// Use OP_LOG for logging with arglist, OP_LOGS if just printing char*
#define OP_LOGS(s) OP_LOG("%s", (s))
#define OP_LOG(s, ...) ALOGD( "%*s" s, level * 2, "", __VA_ARGS__ )
+4 −3
Original line number Diff line number Diff line
@@ -16,17 +16,18 @@

#define LOG_TAG "OpenGLRenderer"

#include <utils/Log.h>
#include "Layer.h"

#include "Caches.h"
#include "DeferredDisplayList.h"
#include "Layer.h"
#include "LayerRenderer.h"
#include "OpenGLRenderer.h"
#include "RenderNode.h"
#include "RenderState.h"
#include "renderstate/RenderState.h"
#include "utils/TraceUtils.h"

#include <utils/Log.h>

#define ATRACE_LAYER_WORK(label) \
    ATRACE_FORMAT("%s HW Layer DisplayList %s %ux%u", \
            label, \
Loading