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

Unified Diff: ui/gfx/codec/png_codec.cc

Issue 397673002: ui/gfx: optimize RGBA to RGB conversion by using memcpy in png_codec.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/codec/png_codec.cc
diff --git a/ui/gfx/codec/png_codec.cc b/ui/gfx/codec/png_codec.cc
index 1bf2aad717e4229300745dab62e9f0d435415d52..645f1858093e35863e3228f4e62f93bc5809c973 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698