don't filter when capturing a screenshot unless needed

bug: 6919952
Change-Id: Ia6fbe9bc7e533a64cfdd6ef7f0cd6b9f11feb947
This commit is contained in:
Mathias Agopian 2012-08-02 16:01:34 -07:00
parent d3ee231edd
commit fcb239d3da
3 changed files with 11 additions and 10 deletions

View File

@ -316,11 +316,9 @@ void LayerBase::draw(const DisplayDevice& hw, const Region& clip) const
onDraw(hw, clip);
}
void LayerBase::drawForScreenShot(const DisplayDevice& hw)
void LayerBase::draw(const DisplayDevice& hw)
{
setFiltering(true);
onDraw( hw, Region(hw.bounds()) );
setFiltering(false);
}
void LayerBase::clearWithOpenGL(const DisplayDevice& hw, const Region& clip,

View File

@ -146,7 +146,7 @@ public:
* to perform the actual drawing.
*/
virtual void draw(const DisplayDevice& hw, const Region& clip) const;
virtual void drawForScreenShot(const DisplayDevice& hw);
virtual void draw(const DisplayDevice& hw);
/**
* onDraw - draws the surface.
@ -249,14 +249,14 @@ public:
void clearWithOpenGL(const DisplayDevice& hw, const Region& clip) const;
void setFiltering(bool filtering);
bool getFiltering() const;
protected:
void clearWithOpenGL(const DisplayDevice& hw, const Region& clip,
GLclampf r, GLclampf g, GLclampf b, GLclampf alpha) const;
void drawWithOpenGL(const DisplayDevice& hw, const Region& clip) const;
void setFiltering(bool filtering);
bool getFiltering() const;
sp<SurfaceFlinger> mFlinger;
private:

View File

@ -698,7 +698,7 @@ void SurfaceFlinger::handleMessageRefresh() {
const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
const sp<LayerBase>& layer(layers[i]);
layer->drawForScreenShot(hw);
layer->draw(hw);
}
success = eglSwapBuffers(eglGetCurrentDisplay(), externalDisplaySurface);
@ -2026,7 +2026,7 @@ status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,
const size_t count = layers.size();
for (size_t i=0 ; i<count ; ++i) {
const sp<LayerBase>& layer(layers[i]);
layer->drawForScreenShot(hw);
layer->draw(hw);
}
hw.compositionComplete();
@ -2544,6 +2544,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
sw = (!sw) ? hw_w : sw;
sh = (!sh) ? hw_h : sh;
const size_t size = sw * sh * 4;
const bool filtering = sw != hw_w || sh != hw_h;
//ALOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d",
// sw, sh, minLayerZ, maxLayerZ);
@ -2586,7 +2587,9 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
if (!(flags & ISurfaceComposer::eLayerHidden)) {
const uint32_t z = layer->drawingState().z;
if (z >= minLayerZ && z <= maxLayerZ) {
layer->drawForScreenShot(hw);
if (filtering) layer->setFiltering(true);
layer->draw(hw);
if (filtering) layer->setFiltering(false);
}
}
}