| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/libgtkui/gtk_util.h" | 5 #include "chrome/browser/ui/libgtkui/gtk_util.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
| 9 #include <gdk/gdkx.h> | 9 #include <gdk/gdkx.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 if ((border_style == GTK_BORDER_STYLE_NONE || | 506 if ((border_style == GTK_BORDER_STYLE_NONE || |
| 507 border_style == GTK_BORDER_STYLE_HIDDEN) || | 507 border_style == GTK_BORDER_STYLE_HIDDEN) || |
| 508 (!border.left && !border.right && !border.top && !border.bottom)) { | 508 (!border.left && !border.right && !border.top && !border.bottom)) { |
| 509 return SK_ColorTRANSPARENT; | 509 return SK_ColorTRANSPARENT; |
| 510 } | 510 } |
| 511 | 511 |
| 512 AddBorders(context); | 512 AddBorders(context); |
| 513 gfx::Size size = GetMinimumWidgetSize(context); | 513 gfx::Size size = GetMinimumWidgetSize(context); |
| 514 CairoSurface surface(size); | 514 CairoSurface surface(size); |
| 515 RenderBackground(size, surface.cairo(), context); | 515 RenderBackground(size, surface.cairo(), context); |
| 516 gtk_render_frame(context, surface.cairo(), 0, 0, 1, 1); | 516 gtk_render_frame(context, surface.cairo(), 0, 0, size.width(), size.height()); |
| 517 return surface.GetAveragePixelValue(true); | 517 return surface.GetAveragePixelValue(true); |
| 518 } | 518 } |
| 519 | 519 |
| 520 SkColor GetSeparatorColor(const char* css_selector) { | 520 SkColor GetSeparatorColor(const char* css_selector) { |
| 521 if (!GtkVersionCheck(3, 20)) | 521 if (!GtkVersionCheck(3, 20)) |
| 522 return GetFgColor(css_selector); | 522 return GetFgColor(css_selector); |
| 523 | 523 |
| 524 // Some themes use borders to render separators, others use a | 524 // Some themes use borders to render separators, others use a |
| 525 // background color. Only return the border color if there is one. | 525 // background color. Only return the border color if there is one. |
| 526 SkColor border = GetBorderColor(css_selector); | 526 SkColor border = GetBorderColor(css_selector); |
| 527 if (SkColorGetA(border)) | 527 if (SkColorGetA(border)) |
| 528 return border; | 528 return border; |
| 529 | 529 |
| 530 return GetBgColor(css_selector); | 530 return GetBgColor(css_selector); |
| 531 } | 531 } |
| 532 #endif | 532 #endif |
| 533 | 533 |
| 534 } // namespace libgtkui | 534 } // namespace libgtkui |
| OLD | NEW |