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

Side by Side Diff: chrome/browser/gtk/tabs/dragged_tab_gtk.cc

Issue 200122: Remove code doing a no-op due to float -> int rounding. (Closed)
Patch Set: Created 11 years, 3 months 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
« no previous file with comments | « chrome/browser/gtk/tab_contents_drag_source.cc ('k') | chrome/browser/gtk/tabs/tab_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = kScalingFactor * gdk_pixbuf_get_height(pixbuf) - 266 int tab_height = static_cast<int>(kScalingFactor *
267 kDragFrameBorderSize; 267 gdk_pixbuf_get_height(pixbuf) -
268 kDragFrameBorderSize);
268 cairo_rectangle(cairo_context, 269 cairo_rectangle(cairo_context,
269 0, tab_height, 270 0, tab_height,
270 size.width(), size.height() - tab_height); 271 size.width(), size.height() - tab_height);
271 cairo_fill(cairo_context); 272 cairo_fill(cairo_context);
272 } 273 }
273 274
274 cairo_destroy(cairo_context); 275 cairo_destroy(cairo_context);
275 276
276 // Set the shape mask. 277 // Set the shape mask.
277 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0); 278 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0);
(...skipping 10 matching lines...) Expand all
288 GdkEventExpose* event, 289 GdkEventExpose* event,
289 DraggedTabGtk* dragged_tab) { 290 DraggedTabGtk* dragged_tab) {
290 GdkPixbuf* pixbuf = dragged_tab->PaintTab(); 291 GdkPixbuf* pixbuf = dragged_tab->PaintTab();
291 if (gtk_util::IsScreenComposited()) { 292 if (gtk_util::IsScreenComposited()) {
292 dragged_tab->SetContainerTransparency(); 293 dragged_tab->SetContainerTransparency();
293 } else { 294 } else {
294 dragged_tab->SetContainerShapeMask(pixbuf); 295 dragged_tab->SetContainerShapeMask(pixbuf);
295 } 296 }
296 297
297 // Only used when not attached. 298 // Only used when not attached.
298 int tab_height = kScalingFactor * gdk_pixbuf_get_height(pixbuf); 299 int tab_height = static_cast<int>(kScalingFactor *
299 int tab_width = kScalingFactor * gdk_pixbuf_get_width(pixbuf); 300 gdk_pixbuf_get_height(pixbuf));
301 int tab_width = static_cast<int>(kScalingFactor *
302 gdk_pixbuf_get_width(pixbuf));
300 303
301 // Draw the render area. 304 // Draw the render area.
302 if (dragged_tab->backing_store_ && !dragged_tab->attached_) { 305 if (dragged_tab->backing_store_ && !dragged_tab->attached_) {
303 // This leaves room for the border. 306 // This leaves room for the border.
304 dragged_tab->backing_store_->PaintToRect( 307 dragged_tab->backing_store_->PaintToRect(
305 gfx::Rect(kDragFrameBorderSize, tab_height, 308 gfx::Rect(kDragFrameBorderSize, tab_height,
306 widget->allocation.width - kTwiceDragFrameBorderSize, 309 widget->allocation.width - kTwiceDragFrameBorderSize,
307 widget->allocation.height - tab_height - 310 widget->allocation.height - tab_height -
308 kDragFrameBorderSize), 311 kDragFrameBorderSize),
309 GDK_DRAWABLE(widget->window)); 312 GDK_DRAWABLE(widget->window));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); 344 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
342 cairo_paint(cr); 345 cairo_paint(cr);
343 346
344 cairo_destroy(cr); 347 cairo_destroy(cr);
345 348
346 g_object_unref(pixbuf); 349 g_object_unref(pixbuf);
347 350
348 // We've already drawn the tab, so don't propagate the expose-event signal. 351 // We've already drawn the tab, so don't propagate the expose-event signal.
349 return TRUE; 352 return TRUE;
350 } 353 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tab_contents_drag_source.cc ('k') | chrome/browser/gtk/tabs/tab_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698