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

Side by Side Diff: chrome/browser/chromeos/frame/panel_controller.cc

Issue 9588003: browser: Minor changes to use SkPoint::iset() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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 | chrome/browser/ui/views/infobars/infobar_background.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/chromeos/frame/panel_controller.h" 5 #include "chrome/browser/chromeos/frame/panel_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Used to draw the background of the panel title window. 68 // Used to draw the background of the panel title window.
69 class TitleBackgroundPainter : public views::Painter { 69 class TitleBackgroundPainter : public views::Painter {
70 public: 70 public:
71 explicit TitleBackgroundPainter(PanelController* controller) 71 explicit TitleBackgroundPainter(PanelController* controller)
72 : panel_controller_(controller) { } 72 : panel_controller_(controller) { }
73 73
74 private: 74 private:
75 // Overridden from views::Painter: 75 // Overridden from views::Painter:
76 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE { 76 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) OVERRIDE {
77 SkRect rect = { 0, 0, size.width(), size.height() };
78 SkPath path; 77 SkPath path;
78 SkRect rect;
79 rect.iset(0, 0, size.width(), size.height());
79 SkScalar corners[] = { 80 SkScalar corners[] = {
80 kTitleCornerRadius, kTitleCornerRadius, 81 kTitleCornerRadius, kTitleCornerRadius,
81 kTitleCornerRadius, kTitleCornerRadius, 82 kTitleCornerRadius, kTitleCornerRadius,
82 0, 0, 83 0, 0,
83 0, 0 84 0, 0
84 }; 85 };
85 path.addRoundRect(rect, corners); 86 path.addRoundRect(rect, corners);
86 SkPaint paint; 87 SkPoint points[2];
87 paint.setStyle(SkPaint::kFill_Style); 88 points[0].iset(0, 0);
88 paint.setFlags(SkPaint::kAntiAlias_Flag); 89 points[1].iset(0, size.height());
89 SkPoint p[2] = { {0, 0}, {0, size.height()} }; 90 SkColor colors[2] = { kTitleActiveGradientStart, kTitleActiveGradientEnd };
90 SkColor colors[2] = {kTitleActiveGradientStart, kTitleActiveGradientEnd};
91 if (panel_controller_->urgent()) { 91 if (panel_controller_->urgent()) {
92 colors[0] = kTitleUrgentGradientStart; 92 colors[0] = kTitleUrgentGradientStart;
93 colors[1] = kTitleUrgentGradientEnd; 93 colors[1] = kTitleUrgentGradientEnd;
94 } 94 }
95 SkShader* s = SkGradientShader::CreateLinear( 95 SkShader* s = SkGradientShader::CreateLinear(
96 p, colors, NULL, 2, SkShader::kClamp_TileMode, NULL); 96 points, colors, NULL, 2, SkShader::kClamp_TileMode, NULL);
97 SkPaint paint;
98 paint.setStyle(SkPaint::kFill_Style);
99 paint.setAntiAlias(true);
97 paint.setShader(s); 100 paint.setShader(s);
98 // Need to unref shader, otherwise never deleted. 101 // Need to unref shader, otherwise never deleted.
99 s->unref(); 102 s->unref();
100 canvas->GetSkCanvas()->drawPath(path, paint); 103 canvas->GetSkCanvas()->drawPath(path, paint);
101 } 104 }
102 105
103 PanelController* panel_controller_; 106 PanelController* panel_controller_;
104 }; 107 };
105 108
106 static bool resources_initialized; 109 static bool resources_initialized;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 views::Button* sender, const views::Event& event) { 483 views::Button* sender, const views::Event& event) {
481 if (panel_controller_ && sender == close_button_) 484 if (panel_controller_ && sender == close_button_)
482 panel_controller_->OnCloseButtonPressed(); 485 panel_controller_->OnCloseButtonPressed();
483 } 486 }
484 487
485 PanelController::TitleContentView::~TitleContentView() { 488 PanelController::TitleContentView::~TitleContentView() {
486 VLOG(1) << "panel: delete " << this; 489 VLOG(1) << "panel: delete " << this;
487 } 490 }
488 491
489 } // namespace chromeos 492 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_background.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698