Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: ui/gfx/compositor/compositor_gl.cc

Issue 8558033: Revert 110783 - Adds a bounds parameter to ui::Compositor::ReadPixels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/compositor/compositor_gl.h ('k') | ui/gfx/compositor/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/compositor_gl.cc
===================================================================
--- ui/gfx/compositor/compositor_gl.cc (revision 110784)
+++ ui/gfx/compositor/compositor_gl.cc (working copy)
@@ -558,15 +558,12 @@
gl_context_ = NULL;
}
-bool CompositorGL::ReadPixels(SkBitmap* bitmap, const gfx::Rect& bounds) {
+bool CompositorGL::ReadPixels(SkBitmap* bitmap) {
MakeCurrent();
- if (bounds.right() > size().width() || bounds.bottom() > size().height())
- return false;
-
bitmap->setConfig(SkBitmap::kARGB_8888_Config,
- bounds.width(),
- bounds.height());
+ size().width(),
+ size().height());
bitmap->allocPixels();
SkAutoLockPixels lock(*bitmap);
unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels());
@@ -578,18 +575,16 @@
GLint current_alignment = 0;
glGetIntegerv(GL_PACK_ALIGNMENT, &current_alignment);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
-
- // Flip vertically to convert to OpenGL coordinates.
- glReadPixels(bounds.x(),
- size().height() - bounds.y() - bounds.height(),
- bounds.width(),
- bounds.height(),
+ glReadPixels(0,
+ 0,
+ size().width(),
+ size().height(),
GL_RGBA,
GL_UNSIGNED_BYTE,
pixels);
glPixelStorei(GL_PACK_ALIGNMENT, current_alignment);
- SwizzleRGBAToBGRAAndFlip(pixels, bounds.size());
+ SwizzleRGBAToBGRAAndFlip(pixels, size());
return true;
}
« no previous file with comments | « ui/gfx/compositor/compositor_gl.h ('k') | ui/gfx/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698