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.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 contents_size_.height(); | 131 contents_size_.height(); |
132 return gfx::Size(width, height); | 132 return gfx::Size(width, height); |
133 } | 133 } |
134 | 134 |
135 //////////////////////////////////////////////////////////////////////////////// | 135 //////////////////////////////////////////////////////////////////////////////// |
136 // DraggedTabView, private: | 136 // DraggedTabView, private: |
137 | 137 |
138 void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { | 138 void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { |
139 gfx::Size ps = GetPreferredSize(); | 139 gfx::Size ps = GetPreferredSize(); |
140 // TODO(pkotwicz): DIP enable this class. | 140 // TODO(pkotwicz): DIP enable this class. |
141 gfx::Canvas scale_canvas(ps, 1.0f, false); | 141 gfx::Canvas scale_canvas(ps, ui::SCALE_FACTOR_100P, false); |
142 SkBitmap& bitmap_device = const_cast<SkBitmap&>( | 142 SkBitmap& bitmap_device = const_cast<SkBitmap&>( |
143 skia::GetTopDevice(*scale_canvas.sk_canvas())->accessBitmap(true)); | 143 skia::GetTopDevice(*scale_canvas.sk_canvas())->accessBitmap(true)); |
144 bitmap_device.eraseARGB(0, 0, 0, 0); | 144 bitmap_device.eraseARGB(0, 0, 0, 0); |
145 | 145 |
146 int tab_height = renderer_bounds_.back().height(); | 146 int tab_height = renderer_bounds_.back().height(); |
147 scale_canvas.FillRect(gfx::Rect(0, tab_height - kDragFrameBorderSize, | 147 scale_canvas.FillRect(gfx::Rect(0, tab_height - kDragFrameBorderSize, |
148 ps.width(), ps.height() - tab_height), | 148 ps.width(), ps.height() - tab_height), |
149 kDraggedTabBorderColor); | 149 kDraggedTabBorderColor); |
150 gfx::Rect image_rect(kDragFrameBorderSize, | 150 gfx::Rect image_rect(kDragFrameBorderSize, |
151 tab_height, | 151 tab_height, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 gfx::Size DraggedTabView::PreferredContainerSize() { | 185 gfx::Size DraggedTabView::PreferredContainerSize() { |
186 gfx::Size ps = GetPreferredSize(); | 186 gfx::Size ps = GetPreferredSize(); |
187 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); | 187 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); |
188 } | 188 } |
189 | 189 |
190 int DraggedTabView::ScaleValue(int value) { | 190 int DraggedTabView::ScaleValue(int value) { |
191 return static_cast<int>(value * kScalingFactor); | 191 return static_cast<int>(value * kScalingFactor); |
192 } | 192 } |
OLD | NEW |