diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 11:20:43 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 11:20:43 +0000 |
commit | 960a70849fa06bca3cf0fdb30cf7e6ca102f24e4 (patch) | |
tree | acb06ff0cde8e09543b673e590f107f11db9d569 /ui | |
parent | 6abca6c58ab51454cfd176a2f79f28cc28179870 (diff) | |
download | chromium_src-960a70849fa06bca3cf0fdb30cf7e6ca102f24e4.zip chromium_src-960a70849fa06bca3cf0fdb30cf7e6ca102f24e4.tar.gz chromium_src-960a70849fa06bca3cf0fdb30cf7e6ca102f24e4.tar.bz2 |
Get rid of swizzle/yflip in ui_compositor now that cc does it
https://bugs.webkit.org/show_bug.cgi?id=96458 moves the swizzle+y-flip that everybody
does after doing a readback into the compositor itself to avoid duplicate work in
the non-GL path. This removes the corresponding flip in ui/compositor, which appears
to be used mainly for tests.
TBR=piman@chromium.org
BUG=
Review URL: https://chromiumcodereview.appspot.com/10917206
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/compositor/compositor.cc | 31 | ||||
-rw-r--r-- | ui/compositor/compositor.h | 5 |
2 files changed, 2 insertions, 34 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 9a00302..beaa73c 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -259,12 +259,8 @@ bool Compositor::ReadPixels(SkBitmap* bitmap, bitmap->allocPixels(); SkAutoLockPixels lock_image(*bitmap); unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels()); - if (host_->compositeAndReadback( - pixels, gfx::Rect(new_origin, bounds_in_pixel.size()))) { - SwizzleRGBAToBGRAAndFlip(pixels, bounds_in_pixel.size()); - return true; - } - return false; + return host_->compositeAndReadback( + pixels, gfx::Rect(new_origin, bounds_in_pixel.size())); } void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { @@ -420,29 +416,6 @@ void Compositor::scheduleComposite() { ScheduleDraw(); } -void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, - const gfx::Size& image_size) { - // Swizzle from RGBA to BGRA - size_t bitmap_size = 4 * image_size.width() * image_size.height(); - for (size_t i = 0; i < bitmap_size; i += 4) - std::swap(pixels[i], pixels[i + 2]); - - // Vertical flip to transform from GL co-ords - size_t row_size = 4 * image_size.width(); - scoped_array<unsigned char> tmp_row(new unsigned char[row_size]); - for (int row = 0; row < image_size.height() / 2; row++) { - memcpy(tmp_row.get(), - &pixels[row * row_size], - row_size); - memcpy(&pixels[row * row_size], - &pixels[bitmap_size - (row + 1) * row_size], - row_size); - memcpy(&pixels[bitmap_size - (row + 1) * row_size], - tmp_row.get(), - row_size); - } -} - void Compositor::NotifyEnd() { last_ended_frame_++; FOR_EACH_OBSERVER(CompositorObserver, diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index ab448a7..8baada9 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -224,11 +224,6 @@ class COMPOSITOR_EXPORT Compositor private: friend class base::RefCounted<Compositor>; - // When reading back pixel data we often get RGBA rather than BGRA pixels and - // and the image often needs to be flipped vertically. - static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, - const gfx::Size& image_size); - // Notifies the compositor that compositing is complete. void NotifyEnd(); |