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

Side by Side Diff: chrome/browser/ui/views/detachable_toolbar_view.cc

Issue 11299262: ui: Use skia::RefPtr<T> for implicit safe reference counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: winbuild Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | ui/gfx/blit_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/views/detachable_toolbar_view.h" 5 #include "chrome/browser/ui/views/detachable_toolbar_view.h"
6 6
7 #include "chrome/browser/themes/theme_service.h" 7 #include "chrome/browser/themes/theme_service.h"
8 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "third_party/skia/include/core/SkShader.h" 9 #include "third_party/skia/include/core/SkShader.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // static 114 // static
115 void DetachableToolbarView::PaintVerticalDivider(gfx::Canvas* canvas, 115 void DetachableToolbarView::PaintVerticalDivider(gfx::Canvas* canvas,
116 int x, 116 int x,
117 int height, 117 int height,
118 int vertical_padding, 118 int vertical_padding,
119 SkColor top_color, 119 SkColor top_color,
120 SkColor middle_color, 120 SkColor middle_color,
121 SkColor bottom_color) { 121 SkColor bottom_color) {
122 // Draw the upper half of the divider. 122 // Draw the upper half of the divider.
123 SkPaint paint; 123 SkPaint paint;
124 SkSafeUnref(paint.setShader(gfx::CreateGradientShader(vertical_padding + 1, 124 skia::RefPtr<SkShader> shader = gfx::CreateGradientShader(
125 height / 2, 125 vertical_padding + 1, height / 2, top_color, middle_color);
126 top_color, 126 paint.setShader(shader.get());
127 middle_color)));
128 SkRect rc = { SkIntToScalar(x), 127 SkRect rc = { SkIntToScalar(x),
129 SkIntToScalar(vertical_padding + 1), 128 SkIntToScalar(vertical_padding + 1),
130 SkIntToScalar(x + 1), 129 SkIntToScalar(x + 1),
131 SkIntToScalar(height / 2) }; 130 SkIntToScalar(height / 2) };
132 canvas->sk_canvas()->drawRect(rc, paint); 131 canvas->sk_canvas()->drawRect(rc, paint);
133 132
134 // Draw the lower half of the divider. 133 // Draw the lower half of the divider.
135 SkPaint paint_down; 134 SkPaint paint_down;
136 SkSafeUnref(paint_down.setShader(gfx::CreateGradientShader( 135 shader = gfx::CreateGradientShader(
137 height / 2, height - vertical_padding, middle_color, bottom_color))); 136 height / 2, height - vertical_padding, middle_color, bottom_color);
137 paint_down.setShader(shader.get());
138 SkRect rc_down = { SkIntToScalar(x), 138 SkRect rc_down = { SkIntToScalar(x),
139 SkIntToScalar(height / 2), 139 SkIntToScalar(height / 2),
140 SkIntToScalar(x + 1), 140 SkIntToScalar(x + 1),
141 SkIntToScalar(height - vertical_padding) }; 141 SkIntToScalar(height - vertical_padding) };
142 canvas->sk_canvas()->drawRect(rc_down, paint_down); 142 canvas->sk_canvas()->drawRect(rc_down, paint_down);
143 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | ui/gfx/blit_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698