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

Side by Side Diff: content/browser/web_contents/aura/shadow_layer_delegate.cc

Issue 291843003: use simpler gradient factories (in prep for removing SkUnitMapper param) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « ash/touch/touch_hud_projection.cc ('k') | ui/native_theme/native_theme_base.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/web_contents/aura/shadow_layer_delegate.h" 5 #include "content/browser/web_contents/aura/shadow_layer_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "third_party/skia/include/effects/SkGradientShader.h" 8 #include "third_party/skia/include/effects/SkGradientShader.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
(...skipping 24 matching lines...) Expand all
35 35
36 void ShadowLayerDelegate::OnPaintLayer(gfx::Canvas* canvas) { 36 void ShadowLayerDelegate::OnPaintLayer(gfx::Canvas* canvas) {
37 SkPoint points[2]; 37 SkPoint points[2];
38 const SkColor kShadowColors[2] = { kShadowLightColor, kShadowDarkColor }; 38 const SkColor kShadowColors[2] = { kShadowLightColor, kShadowDarkColor };
39 39
40 points[0].iset(0, 0); 40 points[0].iset(0, 0);
41 points[1].iset(kShadowThick, 0); 41 points[1].iset(kShadowThick, 0);
42 42
43 skia::RefPtr<SkShader> shader = skia::AdoptRef( 43 skia::RefPtr<SkShader> shader = skia::AdoptRef(
44 SkGradientShader::CreateLinear(points, kShadowColors, NULL, 44 SkGradientShader::CreateLinear(points, kShadowColors, NULL,
45 arraysize(points), SkShader::kRepeat_TileMode, NULL)); 45 arraysize(points), SkShader::kRepeat_TileMode));
46 46
47 gfx::Rect paint_rect = gfx::Rect(0, 0, kShadowThick, 47 gfx::Rect paint_rect = gfx::Rect(0, 0, kShadowThick,
48 layer_->bounds().height()); 48 layer_->bounds().height());
49 SkPaint paint; 49 SkPaint paint;
50 paint.setShader(shader.get()); 50 paint.setShader(shader.get());
51 canvas->sk_canvas()->drawRect(gfx::RectToSkRect(paint_rect), paint); 51 canvas->sk_canvas()->drawRect(gfx::RectToSkRect(paint_rect), paint);
52 } 52 }
53 53
54 void ShadowLayerDelegate::OnDeviceScaleFactorChanged(float scale_factor) { 54 void ShadowLayerDelegate::OnDeviceScaleFactorChanged(float scale_factor) {
55 } 55 }
56 56
57 base::Closure ShadowLayerDelegate::PrepareForLayerBoundsChange() { 57 base::Closure ShadowLayerDelegate::PrepareForLayerBoundsChange() {
58 return base::Bind(&base::DoNothing); 58 return base::Bind(&base::DoNothing);
59 } 59 }
60 60
61 } // namespace content 61 } // namespace content
OLDNEW
« no previous file with comments | « ash/touch/touch_hud_projection.cc ('k') | ui/native_theme/native_theme_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698