| 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/libgtk2ui/gtk2_ui.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <pango/pango.h> | 8 #include <pango/pango.h> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 SkColor gradient_top_color = color_utils::HSLShift(base, kGtkFrameShift); | 1186 SkColor gradient_top_color = color_utils::HSLShift(base, kGtkFrameShift); |
| 1187 int gradient_size; | 1187 int gradient_size; |
| 1188 | 1188 |
| 1189 NativeThemeGtk2::instance()->GetChromeStyleColor(gradient_name, | 1189 NativeThemeGtk2::instance()->GetChromeStyleColor(gradient_name, |
| 1190 &gradient_top_color); | 1190 &gradient_top_color); |
| 1191 gtk_widget_style_get(NativeThemeGtk2::instance()->GetWindow(), | 1191 gtk_widget_style_get(NativeThemeGtk2::instance()->GetWindow(), |
| 1192 "frame-gradient-size", &gradient_size, | 1192 "frame-gradient-size", &gradient_size, |
| 1193 NULL); | 1193 NULL); |
| 1194 | 1194 |
| 1195 if (gradient_size) { | 1195 if (gradient_size) { |
| 1196 skia::RefPtr<SkShader> shader = gfx::CreateGradientShader( | |
| 1197 0, gradient_size, gradient_top_color, base); | |
| 1198 SkPaint paint; | 1196 SkPaint paint; |
| 1199 paint.setStyle(SkPaint::kFill_Style); | 1197 paint.setStyle(SkPaint::kFill_Style); |
| 1200 paint.setAntiAlias(true); | 1198 paint.setAntiAlias(true); |
| 1201 paint.setShader(shader.get()); | 1199 paint.setShader(gfx::CreateGradientShader( |
| 1200 0, gradient_size, gradient_top_color, base)); |
| 1202 | 1201 |
| 1203 canvas.DrawRect(gfx::Rect(0, 0, kToolbarImageWidth, gradient_size), paint); | 1202 canvas.DrawRect(gfx::Rect(0, 0, kToolbarImageWidth, gradient_size), paint); |
| 1204 } | 1203 } |
| 1205 | 1204 |
| 1206 canvas.FillRect(gfx::Rect(0, gradient_size, kToolbarImageWidth, | 1205 canvas.FillRect(gfx::Rect(0, gradient_size, kToolbarImageWidth, |
| 1207 kToolbarImageHeight - gradient_size), base); | 1206 kToolbarImageHeight - gradient_size), base); |
| 1208 return canvas.ExtractImageRep().sk_bitmap(); | 1207 return canvas.ExtractImageRep().sk_bitmap(); |
| 1209 #else | 1208 #else |
| 1210 // Render a GtkHeaderBar as our title bar, cropping out any curved edges on | 1209 // Render a GtkHeaderBar as our title bar, cropping out any curved edges on |
| 1211 // the left and right sides. Also remove the bottom border for good measure. | 1210 // the left and right sides. Also remove the bottom border for good measure. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 // Blacklist scaling factors <130% (crbug.com/484400) and round | 1377 // Blacklist scaling factors <130% (crbug.com/484400) and round |
| 1379 // to 1 decimal to prevent rendering problems (crbug.com/485183). | 1378 // to 1 decimal to prevent rendering problems (crbug.com/485183). |
| 1380 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10; | 1379 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10; |
| 1381 } | 1380 } |
| 1382 | 1381 |
| 1383 } // namespace libgtk2ui | 1382 } // namespace libgtk2ui |
| 1384 | 1383 |
| 1385 views::LinuxUI* BuildGtk2UI() { | 1384 views::LinuxUI* BuildGtk2UI() { |
| 1386 return new libgtk2ui::Gtk2UI; | 1385 return new libgtk2ui::Gtk2UI; |
| 1387 } | 1386 } |
| OLD | NEW |