| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/native_theme_gtk3.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
| 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
| 11 #include "chrome/browser/ui/libgtkui/gtk_util.h" | 11 #include "chrome/browser/ui/libgtkui/gtk_util.h" |
| 12 #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h" | 12 #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h" |
| 13 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
| 14 #include "ui/gfx/color_utils.h" | 14 #include "ui/gfx/color_utils.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/native_theme/native_theme_dark_aura.h" | 16 #include "ui/native_theme/native_theme_dark_aura.h" |
| 17 | 17 |
| 18 namespace libgtkui { | 18 namespace libgtkui { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 void PaintWidget(SkCanvas* canvas, | 22 void PaintWidget(cc::PaintCanvas* canvas, |
| 23 const gfx::Rect& rect, | 23 const gfx::Rect& rect, |
| 24 const char* css_selector, | 24 const char* css_selector, |
| 25 GtkStateFlags state) { | 25 GtkStateFlags state) { |
| 26 SkBitmap bitmap; | 26 SkBitmap bitmap; |
| 27 bitmap.allocN32Pixels(rect.width(), rect.height()); | 27 bitmap.allocN32Pixels(rect.width(), rect.height()); |
| 28 bitmap.eraseColor(0); | 28 bitmap.eraseColor(0); |
| 29 | 29 |
| 30 cairo_surface_t* surface = cairo_image_surface_create_for_data( | 30 cairo_surface_t* surface = cairo_image_surface_create_for_data( |
| 31 static_cast<unsigned char*>(bitmap.getAddr(0, 0)), CAIRO_FORMAT_ARGB32, | 31 static_cast<unsigned char*>(bitmap.getAddr(0, 0)), CAIRO_FORMAT_ARGB32, |
| 32 rect.width(), rect.height(), | 32 rect.width(), rect.height(), |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 SkColor NativeThemeGtk3::GetSystemColor(ColorId color_id) const { | 349 SkColor NativeThemeGtk3::GetSystemColor(ColorId color_id) const { |
| 350 if (color_cache_[color_id]) | 350 if (color_cache_[color_id]) |
| 351 return color_cache_[color_id].value(); | 351 return color_cache_[color_id].value(); |
| 352 | 352 |
| 353 SkColor color = SkColorFromColorId(color_id); | 353 SkColor color = SkColorFromColorId(color_id); |
| 354 color_cache_[color_id] = color; | 354 color_cache_[color_id] = color; |
| 355 return color; | 355 return color; |
| 356 } | 356 } |
| 357 | 357 |
| 358 void NativeThemeGtk3::PaintMenuPopupBackground( | 358 void NativeThemeGtk3::PaintMenuPopupBackground( |
| 359 SkCanvas* canvas, | 359 cc::PaintCanvas* canvas, |
| 360 const gfx::Size& size, | 360 const gfx::Size& size, |
| 361 const MenuBackgroundExtraParams& menu_background) const { | 361 const MenuBackgroundExtraParams& menu_background) const { |
| 362 PaintWidget(canvas, gfx::Rect(size), "GtkMenu#menu", GTK_STATE_FLAG_NORMAL); | 362 PaintWidget(canvas, gfx::Rect(size), "GtkMenu#menu", GTK_STATE_FLAG_NORMAL); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void NativeThemeGtk3::PaintMenuItemBackground( | 365 void NativeThemeGtk3::PaintMenuItemBackground( |
| 366 SkCanvas* canvas, | 366 cc::PaintCanvas* canvas, |
| 367 State state, | 367 State state, |
| 368 const gfx::Rect& rect, | 368 const gfx::Rect& rect, |
| 369 const MenuItemExtraParams& menu_item) const { | 369 const MenuItemExtraParams& menu_item) const { |
| 370 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", | 370 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", |
| 371 StateToStateFlags(state)); | 371 StateToStateFlags(state)); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace libgtkui | 374 } // namespace libgtkui |
| OLD | NEW |