| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/tabs/dragged_tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/dragged_tab_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (!attached_) | 256 if (!attached_) |
| 257 cairo_scale(cairo_context, kScalingFactor, kScalingFactor); | 257 cairo_scale(cairo_context, kScalingFactor, kScalingFactor); |
| 258 gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, 0, 0); | 258 gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, 0, 0); |
| 259 cairo_paint(cairo_context); | 259 cairo_paint(cairo_context); |
| 260 | 260 |
| 261 if (!attached_) { | 261 if (!attached_) { |
| 262 // Make the render area depiction opaque (leaving enough room for the | 262 // Make the render area depiction opaque (leaving enough room for the |
| 263 // border). | 263 // border). |
| 264 cairo_identity_matrix(cairo_context); | 264 cairo_identity_matrix(cairo_context); |
| 265 cairo_set_source_rgba(cairo_context, 1.0f, 1.0f, 1.0f, 1.0f); | 265 cairo_set_source_rgba(cairo_context, 1.0f, 1.0f, 1.0f, 1.0f); |
| 266 int tab_height = static_cast<int>(kScalingFactor * | 266 int tab_height = kScalingFactor * gdk_pixbuf_get_height(pixbuf) - |
| 267 gdk_pixbuf_get_height(pixbuf) - | 267 kDragFrameBorderSize; |
| 268 kDragFrameBorderSize); | |
| 269 cairo_rectangle(cairo_context, | 268 cairo_rectangle(cairo_context, |
| 270 0, tab_height, | 269 0, tab_height, |
| 271 size.width(), size.height() - tab_height); | 270 size.width(), size.height() - tab_height); |
| 272 cairo_fill(cairo_context); | 271 cairo_fill(cairo_context); |
| 273 } | 272 } |
| 274 | 273 |
| 275 cairo_destroy(cairo_context); | 274 cairo_destroy(cairo_context); |
| 276 | 275 |
| 277 // Set the shape mask. | 276 // Set the shape mask. |
| 278 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0); | 277 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 289 GdkEventExpose* event, | 288 GdkEventExpose* event, |
| 290 DraggedTabGtk* dragged_tab) { | 289 DraggedTabGtk* dragged_tab) { |
| 291 GdkPixbuf* pixbuf = dragged_tab->PaintTab(); | 290 GdkPixbuf* pixbuf = dragged_tab->PaintTab(); |
| 292 if (gtk_util::IsScreenComposited()) { | 291 if (gtk_util::IsScreenComposited()) { |
| 293 dragged_tab->SetContainerTransparency(); | 292 dragged_tab->SetContainerTransparency(); |
| 294 } else { | 293 } else { |
| 295 dragged_tab->SetContainerShapeMask(pixbuf); | 294 dragged_tab->SetContainerShapeMask(pixbuf); |
| 296 } | 295 } |
| 297 | 296 |
| 298 // Only used when not attached. | 297 // Only used when not attached. |
| 299 int tab_height = static_cast<int>(kScalingFactor * | 298 int tab_height = kScalingFactor * gdk_pixbuf_get_height(pixbuf); |
| 300 gdk_pixbuf_get_height(pixbuf)); | 299 int tab_width = kScalingFactor * gdk_pixbuf_get_width(pixbuf); |
| 301 int tab_width = static_cast<int>(kScalingFactor * | |
| 302 gdk_pixbuf_get_width(pixbuf)); | |
| 303 | 300 |
| 304 // Draw the render area. | 301 // Draw the render area. |
| 305 if (dragged_tab->backing_store_ && !dragged_tab->attached_) { | 302 if (dragged_tab->backing_store_ && !dragged_tab->attached_) { |
| 306 // This leaves room for the border. | 303 // This leaves room for the border. |
| 307 dragged_tab->backing_store_->PaintToRect( | 304 dragged_tab->backing_store_->PaintToRect( |
| 308 gfx::Rect(kDragFrameBorderSize, tab_height, | 305 gfx::Rect(kDragFrameBorderSize, tab_height, |
| 309 widget->allocation.width - kTwiceDragFrameBorderSize, | 306 widget->allocation.width - kTwiceDragFrameBorderSize, |
| 310 widget->allocation.height - tab_height - | 307 widget->allocation.height - tab_height - |
| 311 kDragFrameBorderSize), | 308 kDragFrameBorderSize), |
| 312 GDK_DRAWABLE(widget->window)); | 309 GDK_DRAWABLE(widget->window)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); | 341 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); |
| 345 cairo_paint(cr); | 342 cairo_paint(cr); |
| 346 | 343 |
| 347 cairo_destroy(cr); | 344 cairo_destroy(cr); |
| 348 | 345 |
| 349 g_object_unref(pixbuf); | 346 g_object_unref(pixbuf); |
| 350 | 347 |
| 351 // We've already drawn the tab, so don't propagate the expose-event signal. | 348 // We've already drawn the tab, so don't propagate the expose-event signal. |
| 352 return TRUE; | 349 return TRUE; |
| 353 } | 350 } |
| OLD | NEW |