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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 11280251: chrome: Use skia::RefPtr for skia ref-counted objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linuxbuild Created 8 years 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) 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/ui/views/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 x = mini_title_animation_->CurrentValueBetween(x0, x1); 1101 x = mini_title_animation_->CurrentValueBetween(x0, x1);
1102 } else if (mini_title_animation_->current_part_index() == 1) { 1102 } else if (mini_title_animation_->current_part_index() == 1) {
1103 x = x1; 1103 x = x1;
1104 } else { 1104 } else {
1105 x = mini_title_animation_->CurrentValueBetween(x1, x2); 1105 x = mini_title_animation_->CurrentValueBetween(x1, x2);
1106 } 1106 }
1107 SkPoint center_point; 1107 SkPoint center_point;
1108 center_point.iset(x, 0); 1108 center_point.iset(x, 0);
1109 SkColor colors[2] = { kMiniTitleChangeGradientColor1, 1109 SkColor colors[2] = { kMiniTitleChangeGradientColor1,
1110 kMiniTitleChangeGradientColor2 }; 1110 kMiniTitleChangeGradientColor2 };
1111 SkShader* shader = SkGradientShader::CreateRadial(center_point, 1111 skia::RefPtr<SkShader> shader = skia::AdoptRef(
1112 SkIntToScalar(radius), colors, NULL, 2, SkShader::kClamp_TileMode); 1112 SkGradientShader::CreateRadial(
1113 center_point, SkIntToScalar(radius), colors, NULL, 2,
1114 SkShader::kClamp_TileMode));
1113 SkPaint paint; 1115 SkPaint paint;
1114 paint.setShader(shader); 1116 paint.setShader(shader.get());
1115 shader->unref();
1116 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), 1117 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2),
1117 paint); 1118 paint);
1118 1119
1119 // Draw the radial gradient clipped to the background into hover_image. 1120 // Draw the radial gradient clipped to the background into hover_image.
1120 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage( 1121 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage(
1121 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); 1122 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image);
1122 1123
1123 // Draw the tab background to the canvas. 1124 // Draw the tab background to the canvas.
1124 canvas->DrawImageInt(background_image, 0, 0); 1125 canvas->DrawImageInt(background_image, 0, 0);
1125 1126
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 const gfx::ImageSkia& image) { 1627 const gfx::ImageSkia& image) {
1627 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1628 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1628 ImageCacheEntry entry; 1629 ImageCacheEntry entry;
1629 entry.resource_id = resource_id; 1630 entry.resource_id = resource_id;
1630 entry.scale_factor = scale_factor; 1631 entry.scale_factor = scale_factor;
1631 entry.image = image; 1632 entry.image = image;
1632 image_cache_->push_front(entry); 1633 image_cache_->push_front(entry);
1633 if (image_cache_->size() > kMaxImageCacheSize) 1634 if (image_cache_->size() > kMaxImageCacheSize)
1634 image_cache_->pop_back(); 1635 image_cache_->pop_back();
1635 } 1636 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/dragged_tab_view.cc ('k') | chrome/browser/ui/views/theme_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698