错误类没有成员命名 - android libtilerenderer

时间:2013-11-21 23:37:39

标签: android c++ class compilation building

我正在尝试构建qcom / msm8960 / libtilerenderer,但我有下一个错误编译:

  

hardware / qcom / display / msm8960 / libtilerenderer / tilerenderer.cpp:在成员函数'void android :: uirenderer :: TileRenderer :: startTileRendering(android :: uirenderer :: OpenGLRenderer *,int,int,int,int) “:   hardware / qcom / display / msm8960 / libtilerenderer / tilerenderer.cpp:50:18:错误:'class android :: uirenderer :: OpenGLRenderer'没有名为'getViewport'的成员   build / core / binary.mk:432:目标'/home/samuel/android/omni/out/target/product/geeb/obj/SHARED_LIBRARIES/libtilerenderer_intermediates/tilerenderer.o'的配方失败

这是tilerenderer.cpp的源代码

#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <gl2ext.h>
#include <OpenGLRenderer.h>
#include "tilerenderer.h"

#define glStartTilingQCOM StartTilingQCOM
#define glEndTilingQCOM EndTilingQCOM
GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);

namespace android {
ANDROID_SINGLETON_STATIC_INSTANCE(uirenderer::TileRenderer) ;
namespace uirenderer {

TileRenderer::TileRenderer() {
    mIsTiled = false;
}

TileRenderer::~TileRenderer() {
}

void TileRenderer::startTileRendering(OpenGLRenderer* renderer,
                                      int left, int top,
                                      int right, int bottom) {
    int width = 0;
    int height = 0;
    GLenum status = GL_NO_ERROR;

    if (renderer != NULL) {
       renderer->getViewport(width, height);
    }

    if (!left && !right && !top && !bottom) {
        left = 0;
        top = 0;
        right = width;
        bottom = height;
    }

    if (!left && !right && !top && !bottom) {
        //can't do tile rendering
        ALOGE("can't tile render; drity region, width, height not available");
        return;
    }

    int l = left, t = (height - bottom), w = (right - left), h = (bottom - top), preserve = 0;

    if (l < 0 || t < 0) {
        l = (l < 0) ? 0 : l;
        t = (t < 0) ? 0 : t;
        preserve = 1;
    }

    if (w > width || h > height) {
        w = (w > width) ? width : w;
        h = (h > height) ? height : h;
        preserve = 1;
    }

    //clear off all errors before tiling, if any
    while ((status = glGetError()) != GL_NO_ERROR);

    if (preserve)
        glStartTilingQCOM(l, t, w, h, GL_COLOR_BUFFER_BIT0_QCOM);
    else
        glStartTilingQCOM(l, t, w, h, GL_NONE);

    status = glGetError();
    if (status == GL_NO_ERROR)
        mIsTiled = true;
}

void TileRenderer::endTileRendering(OpenGLRenderer*) {
    if (!mIsTiled) {
        return;
    }
    glEndTilingQCOM(GL_COLOR_BUFFER_BIT0_QCOM);
    mIsTiled = false;
    GLenum status = GL_NO_ERROR;
    while ((status = glGetError()) != GL_NO_ERROR);
}

}; // namespace uirenderer
}; // namespace android

这是tilerenderer.h的源代码。

#ifndef ANDROID_TILE_RENDERER_H
#define ANDROID_TILE_RENDERER_H

#include <utils/Singleton.h>

namespace android {
namespace uirenderer {

class OpenGLRenderer;

class TileRenderer: public Singleton<TileRenderer> {
    public:
    TileRenderer();
    ~TileRenderer();

    void startTileRendering(OpenGLRenderer* renderer, int left, int top, int right, int bottom);
    void endTileRendering(OpenGLRenderer*);

    private:
    bool mIsTiled;
};

}; // namespace uirenderer
}; // namespace android

#endif

任何帮助解决这个问题,谢谢

1 个答案:

答案 0 :(得分:0)

openGLRenderer.h中没有'getViewport(width,height)函数。

尝试使用

width = renderer->getViewportWidth();
height = renderer->getViewportHeight(); 

代替。

在使用渲染器上的任何调用之前,请参阅https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/OpenGLRenderer.h