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

Side by Side Diff: chrome/browser/ui/views/location_bar/content_setting_image_view.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/location_bar/content_setting_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 10 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 // Paint yellow gradient background if in animation mode. 196 // Paint yellow gradient background if in animation mode.
197 const int kEdgeThickness = 1; 197 const int kEdgeThickness = 1;
198 SkPaint paint; 198 SkPaint paint;
199 paint.setShader(gfx::CreateGradientShader(kEdgeThickness, 199 paint.setShader(gfx::CreateGradientShader(kEdgeThickness,
200 height() - (2 * kEdgeThickness), 200 height() - (2 * kEdgeThickness),
201 kTopBoxColor, kBottomBoxColor)); 201 kTopBoxColor, kBottomBoxColor));
202 SkSafeUnref(paint.getShader()); 202 SkSafeUnref(paint.getShader());
203 SkRect color_rect; 203 SkRect color_rect;
204 color_rect.iset(0, 0, width() - 1, height() - 1); 204 color_rect.iset(0, 0, width() - 1, height() - 1);
205 canvas->AsCanvasSkia()->drawRoundRect(color_rect, kBoxCornerRadius, 205 canvas->GetSkCanvas()->drawRoundRect(color_rect, kBoxCornerRadius,
206 kBoxCornerRadius, paint); 206 kBoxCornerRadius, paint);
207 SkPaint outer_paint; 207 SkPaint outer_paint;
208 outer_paint.setStyle(SkPaint::kStroke_Style); 208 outer_paint.setStyle(SkPaint::kStroke_Style);
209 outer_paint.setColor(kBorderColor); 209 outer_paint.setColor(kBorderColor);
210 color_rect.inset(SkIntToScalar(kEdgeThickness), 210 color_rect.inset(SkIntToScalar(kEdgeThickness),
211 SkIntToScalar(kEdgeThickness)); 211 SkIntToScalar(kEdgeThickness));
212 canvas->AsCanvasSkia()->drawRoundRect(color_rect, kBoxCornerRadius, 212 canvas->GetSkCanvas()->drawRoundRect(color_rect, kBoxCornerRadius,
213 kBoxCornerRadius, outer_paint); 213 kBoxCornerRadius, outer_paint);
214 } 214 }
215 215
216 void ContentSettingImageView::BubbleClosing(Bubble* bubble, 216 void ContentSettingImageView::BubbleClosing(Bubble* bubble,
217 bool closed_by_escape) { 217 bool closed_by_escape) {
218 bubble_ = NULL; 218 bubble_ = NULL;
219 } 219 }
220 220
221 bool ContentSettingImageView::CloseOnEscape() { 221 bool ContentSettingImageView::CloseOnEscape() {
222 return true; 222 return true;
223 } 223 }
(...skipping 12 matching lines...) Expand all
236 kAnimatingFraction); 236 kAnimatingFraction);
237 } else if (state > (1.0 - kAnimatingFraction)) { 237 } else if (state > (1.0 - kAnimatingFraction)) {
238 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) / 238 visible_text_size_ = static_cast<int>(text_size_ * (1.0 - state) /
239 kAnimatingFraction); 239 kAnimatingFraction);
240 } else { 240 } else {
241 visible_text_size_ = text_size_; 241 visible_text_size_ = text_size_;
242 } 242 }
243 parent_->Layout(); 243 parent_->Layout();
244 parent_->SchedulePaint(); 244 parent_->SchedulePaint();
245 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698