大家好,另一个 C++ 编程问题。再次对我轻松一点,因为我刚刚开始学习 C++。我在编译时收到一个错误,显示:
frameworks/native/libs/gui/SurfaceTextureClient.cpp:在成员函数'virtual int >android::SurfaceTextureClient::setUsage(uint32_t)'中:frameworks/native/libs/gui/SurfaceTextureClient.cpp:498:20:错误:> 'GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY' 未在此范围内声明 frameworks/native/libs/gui/SurfaceTextureClient.cpp:503:23:错误:>'GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK' 未在此范围内声明 frameworks/native/libs/gui/SurfaceTextureClient.cpp:505 :30: 错误:>'GRALLOC_USAGE_PRIVATE_EXTERNAL_CC' 未在此范围内声明
这是“SurfaceTextureClient.cpp”文件:
17 #define LOG_TAG "SurfaceTextureClient"
18 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
19 //#define LOG_NDEBUG 0
20
21 #include <android/native_window.h>
22
23 #include <utils/Log.h>
24 #include <utils/Trace.h>
25
26 #include <gui/ISurfaceComposer.h>
27 #include <gui/SurfaceComposerClient.h>
28 #include <gui/SurfaceTexture.h>
29 #include <gui/SurfaceTextureClient.h>
30
31 #include <private/gui/ComposerService.h>
32 #ifdef QCOMHW
33 #include <gralloc_priv.h>
34 #endif
35
36 namespace android {
37
38 SurfaceTextureClient::SurfaceTextureClient(
39 const sp<ISurfaceTexture>& surfaceTexture)
40 {
41 SurfaceTextureClient::init();
42 SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
43 }
44
45 // see SurfaceTextureClient.h
46 SurfaceTextureClient::SurfaceTextureClient(const
47 sp<SurfaceTexture>& surfaceTexture)
48 {
49 SurfaceTextureClient::init();
50 SurfaceTextureClient::setISurfaceTexture(surfaceTexture->getBufferQueue());
51 }
52
53 SurfaceTextureClient::SurfaceTextureClient() {
54 SurfaceTextureClient::init();
55 }
56
57 SurfaceTextureClient::~SurfaceTextureClient() {
58 if (mConnectedToCpu) {
59 SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
60
61 }
494 int SurfaceTextureClient::setUsage(uint32_t reqUsage)
493 {
494 ALOGV("SurfaceTextureClient::setUsage");
495 Mutex::Autolock lock(mMutex);
496
497 #ifdef QCOMHW
498 if (reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
499 //Set explicitly, since reqUsage may have other values.
500 mReqExtUsage = GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY;
501 //This flag is never independent. Always an add-on to
502 //GRALLOC_USAGE_EXTERNAL_ONLY
503 if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK) {
504 mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK;
505 } else if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_CC) {
506 mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_CC;
507 }
508 }
509 #endif
如果需要更多信息,请告诉我。修复了此编译的先前错误。不知道如何处理这个。