| OLD | NEW |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.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)->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.FillRectInt(kDraggedTabBorderColor, 0, |
| 145 tab_height - kDragFrameBorderSize, | 145 tab_height - kDragFrameBorderSize, |
| 146 ps.width(), ps.height() - tab_height); | 146 ps.width(), ps.height() - tab_height); |
| 147 int image_x = kDragFrameBorderSize; | 147 int image_x = kDragFrameBorderSize; |
| 148 int image_y = tab_height; | 148 int image_y = tab_height; |
| 149 int image_w = ps.width() - kTwiceDragFrameBorderSize; | 149 int image_w = ps.width() - kTwiceDragFrameBorderSize; |
| 150 int image_h = contents_size_.height(); | 150 int image_h = contents_size_.height(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 171 SkPaint paint; | 171 SkPaint paint; |
| 172 paint.setShader(bitmap_shader); | 172 paint.setShader(bitmap_shader); |
| 173 paint.setAntiAlias(true); | 173 paint.setAntiAlias(true); |
| 174 bitmap_shader->unref(); | 174 bitmap_shader->unref(); |
| 175 | 175 |
| 176 SkRect rc; | 176 SkRect rc; |
| 177 rc.fLeft = 0; | 177 rc.fLeft = 0; |
| 178 rc.fTop = 0; | 178 rc.fTop = 0; |
| 179 rc.fRight = SkIntToScalar(ps.width()); | 179 rc.fRight = SkIntToScalar(ps.width()); |
| 180 rc.fBottom = SkIntToScalar(ps.height()); | 180 rc.fBottom = SkIntToScalar(ps.height()); |
| 181 canvas->AsCanvasSkia()->drawRect(rc, paint); | 181 canvas->GetSkCanvas()->drawRect(rc, paint); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void DraggedTabView::PaintFocusRect(gfx::Canvas* canvas) { | 184 void DraggedTabView::PaintFocusRect(gfx::Canvas* canvas) { |
| 185 gfx::Size ps = GetPreferredSize(); | 185 gfx::Size ps = GetPreferredSize(); |
| 186 canvas->DrawFocusRect(0, 0, | 186 canvas->DrawFocusRect(0, 0, |
| 187 static_cast<int>(ps.width() * kScalingFactor), | 187 static_cast<int>(ps.width() * kScalingFactor), |
| 188 static_cast<int>(ps.height() * kScalingFactor)); | 188 static_cast<int>(ps.height() * kScalingFactor)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 gfx::Size DraggedTabView::PreferredContainerSize() { | 191 gfx::Size DraggedTabView::PreferredContainerSize() { |
| 192 gfx::Size ps = GetPreferredSize(); | 192 gfx::Size ps = GetPreferredSize(); |
| 193 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); | 193 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); |
| 194 } | 194 } |
| 195 | 195 |
| 196 int DraggedTabView::ScaleValue(int value) { | 196 int DraggedTabView::ScaleValue(int value) { |
| 197 return static_cast<int>(value * kScalingFactor); | 197 return static_cast<int>(value * kScalingFactor); |
| 198 } | 198 } |
| OLD | NEW |