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

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: 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 | « no previous file | ui/gfx/blit_unittest.cc » ('j') | ui/gfx/canvas.cc » ('J')
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
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 skia::RefPtr<SkShader> shader;
sky 2012/11/29 23:54:56 Is there a reason for keeping this here and not at
danakj 2012/11/30 00:12:21 Nope, will move it.
123
122 // Draw the upper half of the divider. 124 // Draw the upper half of the divider.
123 SkPaint paint; 125 SkPaint paint;
124 SkSafeUnref(paint.setShader(gfx::CreateGradientShader(vertical_padding + 1, 126 shader = gfx::CreateGradientShader(
125 height / 2, 127 vertical_padding + 1, height / 2, top_color, middle_color);
126 top_color, 128 paint.setShader(shader.get());
127 middle_color)));
128 SkRect rc = { SkIntToScalar(x), 129 SkRect rc = { SkIntToScalar(x),
129 SkIntToScalar(vertical_padding + 1), 130 SkIntToScalar(vertical_padding + 1),
130 SkIntToScalar(x + 1), 131 SkIntToScalar(x + 1),
131 SkIntToScalar(height / 2) }; 132 SkIntToScalar(height / 2) };
132 canvas->sk_canvas()->drawRect(rc, paint); 133 canvas->sk_canvas()->drawRect(rc, paint);
133 134
134 // Draw the lower half of the divider. 135 // Draw the lower half of the divider.
135 SkPaint paint_down; 136 SkPaint paint_down;
136 SkSafeUnref(paint_down.setShader(gfx::CreateGradientShader( 137 shader = gfx::CreateGradientShader(
137 height / 2, height - vertical_padding, middle_color, bottom_color))); 138 height / 2, height - vertical_padding, middle_color, bottom_color);
139 paint_down.setShader(shader.get());
138 SkRect rc_down = { SkIntToScalar(x), 140 SkRect rc_down = { SkIntToScalar(x),
139 SkIntToScalar(height / 2), 141 SkIntToScalar(height / 2),
140 SkIntToScalar(x + 1), 142 SkIntToScalar(x + 1),
141 SkIntToScalar(height - vertical_padding) }; 143 SkIntToScalar(height - vertical_padding) };
142 canvas->sk_canvas()->drawRect(rc_down, paint_down); 144 canvas->sk_canvas()->drawRect(rc_down, paint_down);
143 } 145 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/blit_unittest.cc » ('j') | ui/gfx/canvas.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698