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

Unified Diff: chrome/browser/ui/gtk/cairo_cached_surface.h

Issue 8769017: GTK: Move CairoCachedSurface from being owned by GtkThemeService to gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase for commit Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/cairo_cached_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/cairo_cached_surface.h
diff --git a/chrome/browser/ui/gtk/cairo_cached_surface.h b/chrome/browser/ui/gtk/cairo_cached_surface.h
deleted file mode 100644
index eb481e84cde2d3bbdcba797df23b2de091facb3f..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/gtk/cairo_cached_surface.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
-#define CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
-#pragma once
-
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _cairo cairo_t;
-typedef struct _cairo_surface cairo_surface_t;
-
-// A helper class that takes a GdkPixbuf* and renders it to the screen. Unlike
-// gdk_cairo_set_source_pixbuf(), CairoCachedSurface assumes that the pixbuf is
-// immutable after UsePixbuf() is called and can be sent to the X server
-// once. From then on, that cached version is used so we don't upload the same
-// image each and every time we expose.
-//
-// Most cached surfaces are owned by the GtkThemeService, which associates
-// them with a certain XDisplay. Some users of surfaces (CustomDrawButtonBase,
-// for example) own their surfaces instead since they interact with the
-// ResourceBundle instead of the GtkThemeService.
-class CairoCachedSurface {
- public:
- CairoCachedSurface();
- ~CairoCachedSurface();
-
- // Whether this CairoCachedSurface owns a GdkPixbuf.
- bool valid() const {
- return pixbuf_;
- }
-
- // Delete all our data.
- void Reset();
-
- // The dimensions of the underlying pixbuf/surface. (or -1 if invalid.)
- int Width() const;
- int Height() const;
-
- // Sets the pixbuf that we pass to cairo. Calling UsePixbuf() only derefs the
- // current pixbuf and surface (if they exist). Actually transfering data to
- // the X server occurs at SetSource() time. Calling UsePixbuf() should only
- // be done once as it clears cached data from the X server.
- void UsePixbuf(GdkPixbuf* pixbuf);
-
- // Sets our pixbuf as the active surface starting at (x, y), uploading it in
- // case we don't have an X backed surface cached.
- void SetSource(cairo_t* cr, int x, int y);
-
- // Performs a mask operation, using this surface as the alpha channel.
- void MaskSource(cairo_t* cr, int x, int y);
-
- // Raw access to the pixbuf. May be NULL. Used for a few gdk operations
- // regarding window shaping.
- GdkPixbuf* pixbuf() { return pixbuf_; }
-
- private:
- // Makes sure |surface_| is a valid thing that lives on the X server,
- // uploading it if necessary.
- void EnsureSurfaceValid(cairo_t* cr);
-
- // The source pixbuf.
- GdkPixbuf* pixbuf_;
-
- // Our cached surface. This should be a xlib surface so the data lives on the
- // server instead of on the client.
- cairo_surface_t* surface_;
-};
-
-#endif // CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/gtk/cairo_cached_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698