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

Side by Side Diff: chrome/browser/ui/views/web_intent_picker_views.cc

Issue 10824359: Remove ImageSkia::empty and ImageSkia::extractSubset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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) 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 21 matching lines...) Expand all
32 #include "grit/shared_resources.h" 32 #include "grit/shared_resources.h"
33 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
34 #include "grit/ui_resources.h" 34 #include "grit/ui_resources.h"
35 #include "ipc/ipc_message.h" 35 #include "ipc/ipc_message.h"
36 #include "third_party/skia/include/core/SkColor.h" 36 #include "third_party/skia/include/core/SkColor.h"
37 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/base/resource/resource_bundle.h" 38 #include "ui/base/resource/resource_bundle.h"
39 #include "ui/base/text/text_elider.h" 39 #include "ui/base/text/text_elider.h"
40 #include "ui/gfx/canvas.h" 40 #include "ui/gfx/canvas.h"
41 #include "ui/gfx/image/image.h" 41 #include "ui/gfx/image/image.h"
42 #include "ui/gfx/image/image_skia_operations.h"
42 #include "ui/views/border.h" 43 #include "ui/views/border.h"
43 #include "ui/views/controls/button/image_button.h" 44 #include "ui/views/controls/button/image_button.h"
44 #include "ui/views/controls/button/text_button.h" 45 #include "ui/views/controls/button/text_button.h"
45 #include "ui/views/controls/image_view.h" 46 #include "ui/views/controls/image_view.h"
46 #include "ui/views/controls/label.h" 47 #include "ui/views/controls/label.h"
47 #include "ui/views/controls/link.h" 48 #include "ui/views/controls/link.h"
48 #include "ui/views/controls/link_listener.h" 49 #include "ui/views/controls/link_listener.h"
49 #include "ui/views/controls/throbber.h" 50 #include "ui/views/controls/throbber.h"
50 #include "ui/views/controls/webview/webview.h" 51 #include "ui/views/controls/webview/webview.h"
51 #include "ui/views/layout/box_layout.h" 52 #include "ui/views/layout/box_layout.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const gfx::ImageSkia& ThrobberNativeTextButton::GetImageToPaint() const { 213 const gfx::ImageSkia& ThrobberNativeTextButton::GetImageToPaint() const {
213 if (!running_) 214 if (!running_)
214 return NativeTextButton::GetImageToPaint(); 215 return NativeTextButton::GetImageToPaint();
215 216
216 const base::TimeDelta elapsed_time = base::TimeTicks::Now() - start_time_; 217 const base::TimeDelta elapsed_time = base::TimeTicks::Now() - start_time_;
217 const int current_frame = 218 const int current_frame =
218 static_cast<int>(elapsed_time / frame_time_) % frame_count_; 219 static_cast<int>(elapsed_time / frame_time_) % frame_count_;
219 const int image_size = frames_->height(); 220 const int image_size = frames_->height();
220 const int image_offset = current_frame * image_size; 221 const int image_offset = current_frame * image_size;
221 222
222 SkIRect subset_rect = SkIRect::MakeXYWH(image_offset, 0, 223 gfx::Rect subset_rect(image_offset, 0, image_size, image_size);
223 image_size, image_size); 224 this_frame_ = gfx::ImageSkiaOperations::ExtractSubset(*frames_, subset_rect);
224 frames_->extractSubset(&this_frame_, subset_rect);
225 return this_frame_; 225 return this_frame_;
226 } 226 }
227 227
228 void ThrobberNativeTextButton::Run() { 228 void ThrobberNativeTextButton::Run() {
229 DCHECK(running_); 229 DCHECK(running_);
230 230
231 SchedulePaint(); 231 SchedulePaint();
232 } 232 }
233 233
234 // ServiceButtonsView ---------------------------------------------------------- 234 // ServiceButtonsView ----------------------------------------------------------
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1199 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1200 views::ImageButton* close_button = new views::ImageButton(this); 1200 views::ImageButton* close_button = new views::ImageButton(this);
1201 close_button->SetImage(views::CustomButton::BS_NORMAL, 1201 close_button->SetImage(views::CustomButton::BS_NORMAL,
1202 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X)); 1202 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X));
1203 close_button->SetImage(views::CustomButton::BS_HOT, 1203 close_button->SetImage(views::CustomButton::BS_HOT,
1204 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); 1204 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1205 close_button->SetImage(views::CustomButton::BS_PUSHED, 1205 close_button->SetImage(views::CustomButton::BS_PUSHED,
1206 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER)); 1206 rb.GetImageSkiaNamed(IDR_SHARED_IMAGES_X_HOVER));
1207 return close_button; 1207 return close_button;
1208 } 1208 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/balloon_view_ash.cc ('k') | chrome/browser/ui/webui/chromeos/login/network_dropdown.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698