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

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

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 years, 1 month 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/tabs/dragged_tab_view.h" 5 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" 8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h"
9 #include "third_party/skia/include/core/SkShader.h" 9 #include "third_party/skia/include/core/SkShader.h"
10 #include "ui/gfx/canvas_skia.h" 10 #include "ui/gfx/canvas_skia.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // DraggedTabView, private: 134 // DraggedTabView, private:
135 135
136 void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { 136 void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) {
137 gfx::Size ps = GetPreferredSize(); 137 gfx::Size ps = GetPreferredSize();
138 gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false); 138 gfx::CanvasSkia scale_canvas(ps.width(), ps.height(), false);
139 SkBitmap& bitmap_device = const_cast<SkBitmap&>( 139 SkBitmap& bitmap_device = const_cast<SkBitmap&>(
140 skia::GetTopDevice(*scale_canvas.sk_canvas())->accessBitmap(true)); 140 skia::GetTopDevice(*scale_canvas.sk_canvas())->accessBitmap(true));
141 bitmap_device.eraseARGB(0, 0, 0, 0); 141 bitmap_device.eraseARGB(0, 0, 0, 0);
142 142
143 int tab_height = renderer_bounds_.back().height(); 143 int tab_height = renderer_bounds_.back().height();
144 scale_canvas.FillRectInt(kDraggedTabBorderColor, 0, 144 scale_canvas.FillRect(kDraggedTabBorderColor,
145 tab_height - kDragFrameBorderSize, 145 gfx::Rect(0, tab_height - kDragFrameBorderSize,
146 ps.width(), ps.height() - tab_height); 146 ps.width(), ps.height() - tab_height));
147 int image_x = kDragFrameBorderSize; 147 gfx::Rect image_rect(kDragFrameBorderSize,
148 int image_y = tab_height; 148 tab_height,
149 int image_w = ps.width() - kTwiceDragFrameBorderSize; 149 ps.width() - kTwiceDragFrameBorderSize,
150 int image_h = contents_size_.height(); 150 contents_size_.height());
151 scale_canvas.FillRectInt(SK_ColorBLACK, image_x, image_y, image_w, image_h); 151 scale_canvas.FillRect(SK_ColorBLACK, image_rect);
152 photobooth_->PaintScreenshotIntoCanvas( 152 photobooth_->PaintScreenshotIntoCanvas(&scale_canvas, image_rect);
153 &scale_canvas,
154 gfx::Rect(image_x, image_y, image_w, image_h));
155 for (size_t i = 0; i < renderers_.size(); ++i) 153 for (size_t i = 0; i < renderers_.size(); ++i)
156 renderers_[i]->Paint(&scale_canvas); 154 renderers_[i]->Paint(&scale_canvas);
157 155
158 SkIRect subset; 156 SkIRect subset;
159 subset.set(0, 0, ps.width(), ps.height()); 157 subset.set(0, 0, ps.width(), ps.height());
160 SkBitmap mipmap = scale_canvas.ExtractBitmap(); 158 SkBitmap mipmap = scale_canvas.ExtractBitmap();
161 mipmap.buildMipMap(true); 159 mipmap.buildMipMap(true);
162 160
163 SkShader* bitmap_shader = 161 SkShader* bitmap_shader =
164 SkShader::CreateBitmapShader(mipmap, SkShader::kClamp_TileMode, 162 SkShader::CreateBitmapShader(mipmap, SkShader::kClamp_TileMode,
(...skipping 25 matching lines...) Expand all
190 } 188 }
191 189
192 gfx::Size DraggedTabView::PreferredContainerSize() { 190 gfx::Size DraggedTabView::PreferredContainerSize() {
193 gfx::Size ps = GetPreferredSize(); 191 gfx::Size ps = GetPreferredSize();
194 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); 192 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height()));
195 } 193 }
196 194
197 int DraggedTabView::ScaleValue(int value) { 195 int DraggedTabView::ScaleValue(int value) {
198 return static_cast<int>(value * kScalingFactor); 196 return static_cast<int>(value * kScalingFactor);
199 } 197 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698