summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhyunki.baik@samsung.com <hyunki.baik@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-16 07:33:29 +0000
committerhyunki.baik@samsung.com <hyunki.baik@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-16 07:33:29 +0000
commit58240a727a5709b1330c33a65d8ee24064481215 (patch)
treed1187699da263bd4b5515a94219a838376bd4ca9
parent285c4bf4e2fe63f087391217b411d6b080732a80 (diff)
downloadchromium_src-58240a727a5709b1330c33a65d8ee24064481215.zip
chromium_src-58240a727a5709b1330c33a65d8ee24064481215.tar.gz
chromium_src-58240a727a5709b1330c33a65d8ee24064481215.tar.bz2
ui/gfx: optimize RGBA to RGB conversion by using memcpy in png_codec.cc
BUG=none TEST=gfx_unittests --gtest_filter="PNGCodec*" Review URL: https://codereview.chromium.org/397673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283385 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/gfx/codec/png_codec.cc9
1 files changed, 2 insertions, 7 deletions
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc
index 1bf2aad..645f185 100644
--- a/ui/gfx/codec/png_codec.cc
+++ b/ui/gfx/codec/png_codec.cc
@@ -33,13 +33,8 @@ void ConvertBetweenBGRAandRGBA(const unsigned char* input, int pixel_width,
void ConvertRGBAtoRGB(const unsigned char* rgba, int pixel_width,
unsigned char* rgb, bool* is_opaque) {
- for (int x = 0; x < pixel_width; x++) {
- const unsigned char* pixel_in = &rgba[x * 4];
- unsigned char* pixel_out = &rgb[x * 3];
- pixel_out[0] = pixel_in[0];
- pixel_out[1] = pixel_in[1];
- pixel_out[2] = pixel_in[2];
- }
+ for (int x = 0; x < pixel_width; x++)
+ memcpy(&rgb[x * 3], &rgba[x * 4], 3);
}
void ConvertSkiatoRGB(const unsigned char* skia, int pixel_width,