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

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

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 years, 6 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
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/macros.h" 7 #include "base/macros.h"
8 #include "cc/paint/paint_shader.h" 8 #include "cc/paint/paint_shader.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 27 matching lines...) Expand all
38 void ShadowLayerDelegate::OnPaintLayer(const ui::PaintContext& context) { 38 void ShadowLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
39 SkPoint points[2]; 39 SkPoint points[2];
40 const SkColor kShadowColors[2] = { kShadowLightColor, kShadowDarkColor }; 40 const SkColor kShadowColors[2] = { kShadowLightColor, kShadowDarkColor };
41 41
42 points[0].iset(0, 0); 42 points[0].iset(0, 0);
43 points[1].iset(kShadowThick, 0); 43 points[1].iset(kShadowThick, 0);
44 44
45 gfx::Rect paint_rect = gfx::Rect(0, 0, kShadowThick, 45 gfx::Rect paint_rect = gfx::Rect(0, 0, kShadowThick,
46 layer_->bounds().height()); 46 layer_->bounds().height());
47 cc::PaintFlags flags; 47 cc::PaintFlags flags;
48 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( 48 flags.setShader(cc::PaintShader::MakeLinearGradient(
49 points, kShadowColors, NULL, arraysize(points), 49 points, kShadowColors, nullptr, arraysize(points),
50 SkShader::kRepeat_TileMode))); 50 SkShader::kRepeat_TileMode));
51 ui::PaintRecorder recorder(context, layer_->size()); 51 ui::PaintRecorder recorder(context, layer_->size());
52 recorder.canvas()->DrawRect(paint_rect, flags); 52 recorder.canvas()->DrawRect(paint_rect, flags);
53 } 53 }
54 54
55 void ShadowLayerDelegate::OnDelegatedFrameDamage( 55 void ShadowLayerDelegate::OnDelegatedFrameDamage(
56 const gfx::Rect& damage_rect_in_dip) { 56 const gfx::Rect& damage_rect_in_dip) {
57 } 57 }
58 58
59 void ShadowLayerDelegate::OnDeviceScaleFactorChanged(float scale_factor) { 59 void ShadowLayerDelegate::OnDeviceScaleFactorChanged(float scale_factor) {
60 } 60 }
61 61
62 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698