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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc

Issue 100161: Back to creating a new GC for each expose. (Closed)
Patch Set: Created 11 years, 7 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 | « no previous file | no next file » | 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/autocomplete/autocomplete_popup_view_gtk.h" 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 gfx::Rect damage_rect = gfx::Rect(event->area); 381 gfx::Rect damage_rect = gfx::Rect(event->area);
382 // Handle when our window is super narrow. A bunch of the calculations 382 // Handle when our window is super narrow. A bunch of the calculations
383 // below would go negative, and really we're not going to fit anything 383 // below would go negative, and really we're not going to fit anything
384 // useful in such a small window anyway. Just don't paint anything. 384 // useful in such a small window anyway. Just don't paint anything.
385 // This means we won't draw the border, but, yeah, whatever. 385 // This means we won't draw the border, but, yeah, whatever.
386 // TODO(deanm): Make the code more robust and remove this check. 386 // TODO(deanm): Make the code more robust and remove this check.
387 if (window_rect.width() < (kIconAreaWidth * 3)) 387 if (window_rect.width() < (kIconAreaWidth * 3))
388 return TRUE; 388 return TRUE;
389 389
390 GdkDrawable* drawable = GDK_DRAWABLE(event->window); 390 GdkDrawable* drawable = GDK_DRAWABLE(event->window);
391 // We don't actually care about the style, we just need a GC. 391 GdkGC* gc = gdk_gc_new(drawable);
392 GdkGC* gc = widget->style->black_gc;
393 392
394 // kBorderColor is unallocated, so use the GdkRGB routine. 393 // kBorderColor is unallocated, so use the GdkRGB routine.
395 gdk_gc_set_rgb_fg_color(gc, &kBorderColor); 394 gdk_gc_set_rgb_fg_color(gc, &kBorderColor);
396 395
397 // This assert is kinda ugly, but it would be more currently unneeded work 396 // This assert is kinda ugly, but it would be more currently unneeded work
398 // to support painting a border that isn't 1 pixel thick. There is no point 397 // to support painting a border that isn't 1 pixel thick. There is no point
399 // in writing that code now, and explode if that day ever comes. 398 // in writing that code now, and explode if that day ever comes.
400 COMPILE_ASSERT(kBorderThickness == 1, border_1px_implied); 399 COMPILE_ASSERT(kBorderThickness == 1, border_1px_implied);
401 // Draw the 1px border around the entire window. 400 // Draw the 1px border around the entire window.
402 gdk_draw_rectangle(drawable, gc, FALSE, 401 gdk_draw_rectangle(drawable, gc, FALSE,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 std::string(" - ")); 464 std::string(" - "));
466 465
467 gdk_draw_layout(drawable, gc, 466 gdk_draw_layout(drawable, gc,
468 kIconAreaWidth + actual_content_width, content_y, 467 kIconAreaWidth + actual_content_width, content_y,
469 layout_); 468 layout_);
470 } 469 }
471 } 470 }
472 471
473 return TRUE; 472 return TRUE;
474 } 473 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698