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

Side by Side Diff: ui/native_theme/native_theme_aura.cc

Issue 165473003: Fixes bug in paint scrollbar corner (again) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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 | no next file » | 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 "ui/native_theme/native_theme_aura.h" 5 #include "ui/native_theme/native_theme_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/base/nine_image_painter_factory.h" 10 #include "ui/base/nine_image_painter_factory.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
13 #include "ui/gfx/nine_image_painter.h" 13 #include "ui/gfx/nine_image_painter.h"
14 #include "ui/gfx/path.h" 14 #include "ui/gfx/path.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 #include "ui/gfx/skbitmap_operations.h" 17 #include "ui/gfx/skbitmap_operations.h"
18 #include "ui/gfx/skia_util.h"
18 #include "ui/native_theme/common_theme.h" 19 #include "ui/native_theme/common_theme.h"
19 20
20 using gfx::NineImagePainter; 21 using gfx::NineImagePainter;
21 22
22 #define EMPTY_IMAGE_GRID { 0, 0, 0, 0, 0, 0, 0, 0, 0 } 23 #define EMPTY_IMAGE_GRID { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
23 24
24 namespace ui { 25 namespace ui {
25 26
26 namespace { 27 namespace {
27 28
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 else 160 else
160 thumb_rect.Inset(extra_padding, 2, extra_padding, 2); 161 thumb_rect.Inset(extra_padding, 2, extra_padding, 2);
161 PaintPainter(GetOrCreatePainter( 162 PaintPainter(GetOrCreatePainter(
162 kScrollbarThumbImages, state, scrollbar_thumb_painters_), 163 kScrollbarThumbImages, state, scrollbar_thumb_painters_),
163 sk_canvas, thumb_rect); 164 sk_canvas, thumb_rect);
164 } 165 }
165 166
166 void NativeThemeAura::PaintScrollbarCorner(SkCanvas* canvas, 167 void NativeThemeAura::PaintScrollbarCorner(SkCanvas* canvas,
167 State state, 168 State state,
168 const gfx::Rect& rect) const { 169 const gfx::Rect& rect) const {
169 canvas->drawColor(SkColorSetRGB(0xF1, 0xF1, 0xF1), SkXfermode::kSrc_Mode); 170 SkPaint paint;
171 paint.setColor(SkColorSetRGB(0xF1, 0xF1, 0xF1));
172 paint.setStyle(SkPaint::kFill_Style);
173 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
174 canvas->drawIRect(RectToSkIRect(rect), paint);
170 } 175 }
171 176
172 NineImagePainter* NativeThemeAura::GetOrCreatePainter( 177 NineImagePainter* NativeThemeAura::GetOrCreatePainter(
173 const int images[kMaxState][9], 178 const int images[kMaxState][9],
174 State state, 179 State state,
175 scoped_ptr<NineImagePainter> painters[kMaxState]) const { 180 scoped_ptr<NineImagePainter> painters[kMaxState]) const {
176 if (painters[state]) 181 if (painters[state])
177 return painters[state].get(); 182 return painters[state].get();
178 if (images[state][0] == 0) { 183 if (images[state][0] == 0) {
179 // Must always provide normal state images. 184 // Must always provide normal state images.
180 DCHECK_NE(kNormal, state); 185 DCHECK_NE(kNormal, state);
181 return GetOrCreatePainter(images, kNormal, painters); 186 return GetOrCreatePainter(images, kNormal, painters);
182 } 187 }
183 painters[state] = CreateNineImagePainter(images[state]); 188 painters[state] = CreateNineImagePainter(images[state]);
184 return painters[state].get(); 189 return painters[state].get();
185 } 190 }
186 191
187 void NativeThemeAura::PaintPainter(NineImagePainter* painter, 192 void NativeThemeAura::PaintPainter(NineImagePainter* painter,
188 SkCanvas* sk_canvas, 193 SkCanvas* sk_canvas,
189 const gfx::Rect& rect) const { 194 const gfx::Rect& rect) const {
190 DCHECK(painter); 195 DCHECK(painter);
191 scoped_ptr<gfx::Canvas> canvas(CreateCanvas(sk_canvas)); 196 scoped_ptr<gfx::Canvas> canvas(CreateCanvas(sk_canvas));
192 painter->Paint(canvas.get(), rect); 197 painter->Paint(canvas.get(), rect);
193 } 198 }
194 199
195 } // namespace ui 200 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698