OLD | NEW |
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/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.h" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 | 12 |
13 #if defined(USE_AURA) | 13 #if defined(USE_AURA) |
14 #include "ui/views/widget/native_widget_aura.h" | 14 #include "ui/views/widget/native_widget_aura.h" |
15 #elif defined(OS_WIN) | 15 #elif defined(OS_WIN) |
16 #include "ui/views/widget/native_widget_win.h" | 16 #include "ui/views/widget/native_widget_win.h" |
17 #elif defined(TOOLKIT_USES_GTK) | 17 #elif defined(TOOLKIT_USES_GTK) |
18 #include "ui/views/widget/native_widget_gtk.h" | 18 #include "ui/views/widget/native_widget_gtk.h" |
19 #endif | 19 #endif |
20 | 20 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 int height = renderer_bounds_.back().height() + kDragFrameBorderSize + | 128 int height = renderer_bounds_.back().height() + kDragFrameBorderSize + |
129 contents_size_.height(); | 129 contents_size_.height(); |
130 return gfx::Size(width, height); | 130 return gfx::Size(width, height); |
131 } | 131 } |
132 | 132 |
133 //////////////////////////////////////////////////////////////////////////////// | 133 //////////////////////////////////////////////////////////////////////////////// |
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, false); | 138 gfx::Canvas scale_canvas(ps, 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.FillRect(gfx::Rect(0, tab_height - kDragFrameBorderSize, | 144 scale_canvas.FillRect(gfx::Rect(0, tab_height - kDragFrameBorderSize, |
145 ps.width(), ps.height() - tab_height), | 145 ps.width(), ps.height() - tab_height), |
146 kDraggedTabBorderColor); | 146 kDraggedTabBorderColor); |
147 gfx::Rect image_rect(kDragFrameBorderSize, | 147 gfx::Rect image_rect(kDragFrameBorderSize, |
148 tab_height, | 148 tab_height, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 gfx::Size DraggedTabView::PreferredContainerSize() { | 190 gfx::Size DraggedTabView::PreferredContainerSize() { |
191 gfx::Size ps = GetPreferredSize(); | 191 gfx::Size ps = GetPreferredSize(); |
192 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); | 192 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); |
193 } | 193 } |
194 | 194 |
195 int DraggedTabView::ScaleValue(int value) { | 195 int DraggedTabView::ScaleValue(int value) { |
196 return static_cast<int>(value * kScalingFactor); | 196 return static_cast<int>(value * kScalingFactor); |
197 } | 197 } |
OLD | NEW |