fd1fb639a1
Squashed commit of the following:
commit 012d3fe41d1d6cd38a0858b59145e9a4447641fa
Author: Hashcode <hashcode0f@gmail.com>
Date: Sun Dec 8 19:36:50 2013 +0000
sf: Always use opengles for screen capture
Go back to the usage of GRALLOC_USAGE_HW_TEXTURE and GRALLOC_USAGE_HW_RENDERER
in captureScreenImplLocked regardless of useReadPixels value
This fixes the EGL_NO_IMAGE_KHR error returned from
eglCreateImageKHR (blank images returned from screenshot path)
Change-Id: I62fe90a081607b9e89c67f3dcfd34c84efc89d35
commit 4866ddf98ac98d8e22a1cd6a21894bb17f274588
Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date: Thu Oct 31 03:53:39 2013 +0000
Revert "remove support for glReadPixels screenshot path"
This reverts commit 3ca76f416b
.
Conflicts:
include/gui/ISurfaceComposer.h
libs/gui/ISurfaceComposer.cpp
libs/gui/SurfaceComposerClient.cpp
services/surfaceflinger/SurfaceFlinger.cpp
services/surfaceflinger/SurfaceFlinger.h
Change-Id: I8c239e533757af770e418dbb198f5a86c736961f
Change-Id: I8c239e533757af770e418dbb198f5a86c736961f
130 lines
4.2 KiB
C++
130 lines
4.2 KiB
C++
/*
|
|
* Copyright 2013 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
|
|
#ifndef SF_RENDERENGINE_H_
|
|
#define SF_RENDERENGINE_H_
|
|
|
|
#include <stdint.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <EGL/egl.h>
|
|
#include <EGL/eglext.h>
|
|
#include <ui/mat4.h>
|
|
#include <Transform.h>
|
|
|
|
#define EGL_NO_CONFIG ((EGLConfig)0)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
namespace android {
|
|
// ---------------------------------------------------------------------------
|
|
|
|
class String8;
|
|
class Rect;
|
|
class Region;
|
|
class Mesh;
|
|
class Texture;
|
|
|
|
class RenderEngine {
|
|
enum GlesVersion {
|
|
GLES_VERSION_1_0 = 0x10000,
|
|
GLES_VERSION_1_1 = 0x10001,
|
|
GLES_VERSION_2_0 = 0x20000,
|
|
GLES_VERSION_3_0 = 0x30000,
|
|
};
|
|
static GlesVersion parseGlesVersion(const char* str);
|
|
|
|
EGLConfig mEGLConfig;
|
|
EGLContext mEGLContext;
|
|
void setEGLHandles(EGLConfig config, EGLContext ctxt);
|
|
|
|
virtual void bindImageAsFramebuffer(EGLImageKHR image, uint32_t* texName,
|
|
uint32_t* fbName, uint32_t* status, bool useReadPixels, int reqWidth,
|
|
int reqHeight) = 0;
|
|
virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName,
|
|
bool useReadPixels) = 0;
|
|
|
|
protected:
|
|
RenderEngine();
|
|
virtual ~RenderEngine() = 0;
|
|
|
|
public:
|
|
static RenderEngine* create(EGLDisplay display, int hwcFormat);
|
|
|
|
static EGLConfig chooseEglConfig(EGLDisplay display, int format);
|
|
|
|
// dump the extension strings. always call the base class.
|
|
virtual void dump(String8& result);
|
|
|
|
// helpers
|
|
void flush();
|
|
void clearWithColor(float red, float green, float blue, float alpha);
|
|
void fillRegionWithColor(const Region& region, uint32_t height,
|
|
float red, float green, float blue, float alpha);
|
|
|
|
// common to all GL versions
|
|
void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top);
|
|
void disableScissor();
|
|
void genTextures(size_t count, uint32_t* names);
|
|
void deleteTextures(size_t count, uint32_t const* names);
|
|
void readPixels(size_t l, size_t b, size_t w, size_t h, uint32_t* pixels);
|
|
|
|
class BindImageAsFramebuffer {
|
|
RenderEngine& mEngine;
|
|
uint32_t mTexName, mFbName;
|
|
uint32_t mStatus;
|
|
bool mUseReadPixels;
|
|
public:
|
|
BindImageAsFramebuffer(RenderEngine& engine, EGLImageKHR image,
|
|
bool useReadPixels, int reqWidth, int reqHeight);
|
|
~BindImageAsFramebuffer();
|
|
int getStatus() const;
|
|
};
|
|
|
|
// set-up
|
|
virtual void checkErrors() const;
|
|
virtual void setViewportAndProjection(size_t vpw, size_t vph,
|
|
Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation) = 0;
|
|
virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha) = 0;
|
|
virtual void setupDimLayerBlending(int alpha) = 0;
|
|
virtual void setupLayerTexturing(const Texture& texture) = 0;
|
|
virtual void setupLayerBlackedOut() = 0;
|
|
virtual void setupFillWithColor(float r, float g, float b, float a) = 0;
|
|
|
|
virtual mat4 setupColorTransform(const mat4& /* colorTransform */) {
|
|
return mat4();
|
|
}
|
|
|
|
virtual void disableTexturing() = 0;
|
|
virtual void disableBlending() = 0;
|
|
|
|
// drawing
|
|
virtual void drawMesh(const Mesh& mesh) = 0;
|
|
|
|
// queries
|
|
virtual size_t getMaxTextureSize() const = 0;
|
|
virtual size_t getMaxViewportDims() const = 0;
|
|
|
|
EGLConfig getEGLConfig() const;
|
|
EGLContext getEGLContext() const;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
}; // namespace android
|
|
// ---------------------------------------------------------------------------
|
|
|
|
#endif /* SF_RENDERENGINE_H_ */
|