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

Unified Diff: chrome/browser/gtk/nine_box.cc

Issue 155547: Don't try to set transparency on pixbufs that don't have any transparency.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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: chrome/browser/gtk/nine_box.cc
===================================================================
--- chrome/browser/gtk/nine_box.cc (revision 20666)
+++ chrome/browser/gtk/nine_box.cc (working copy)
@@ -138,11 +138,21 @@
if (!pixbuf)
continue;
+ if (!gdk_pixbuf_get_has_alpha(pixbuf))
+ continue;
+
guchar* pixels = gdk_pixbuf_get_pixels(pixbuf);
int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
+ int width = gdk_pixbuf_get_width(pixbuf);
+ int height = gdk_pixbuf_get_height(pixbuf);
- for (int i = 0; i < gdk_pixbuf_get_height(pixbuf); ++i) {
- for (int j = 0; j < gdk_pixbuf_get_width(pixbuf); ++j) {
+ if (width * 4 > rowstride) {
+ NOTREACHED();
+ continue;
+ }
+
+ for (int i = 0; i < height; ++i) {
+ for (int j = 0; j < width; ++j) {
guchar* pixel = &pixels[i * rowstride + j * 4];
if (pixel[0] == 0xff && pixel[1] == 0xff && pixel[2] == 0xff) {
pixel[3] = 0;
« 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