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

Side by Side Diff: chrome/browser/ui/gtk/cairo_cached_surface.h

Issue 8392011: GTK: Step 1 of tab strip refresh. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to ToT again. Created 9 years, 1 month 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
OLDNEW
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 #ifndef CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
6 #define CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_ 6 #define CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
7 #pragma once 7 #pragma once
8 8
9 typedef struct _GdkPixbuf GdkPixbuf; 9 typedef struct _GdkPixbuf GdkPixbuf;
10 typedef struct _cairo cairo_t; 10 typedef struct _cairo cairo_t;
(...skipping 12 matching lines...) Expand all
23 class CairoCachedSurface { 23 class CairoCachedSurface {
24 public: 24 public:
25 CairoCachedSurface(); 25 CairoCachedSurface();
26 ~CairoCachedSurface(); 26 ~CairoCachedSurface();
27 27
28 // Whether this CairoCachedSurface owns a GdkPixbuf. 28 // Whether this CairoCachedSurface owns a GdkPixbuf.
29 bool valid() const { 29 bool valid() const {
30 return pixbuf_; 30 return pixbuf_;
31 } 31 }
32 32
33 // Delete all our data.
34 void Reset();
35
33 // The dimensions of the underlying pixbuf/surface. (or -1 if invalid.) 36 // The dimensions of the underlying pixbuf/surface. (or -1 if invalid.)
34 int Width() const; 37 int Width() const;
35 int Height() const; 38 int Height() const;
36 39
37 // Sets the pixbuf that we pass to cairo. Calling UsePixbuf() only derefs the 40 // Sets the pixbuf that we pass to cairo. Calling UsePixbuf() only derefs the
38 // current pixbuf and surface (if they exist). Actually transfering data to 41 // current pixbuf and surface (if they exist). Actually transfering data to
39 // the X server occurs at SetSource() time. Calling UsePixbuf() should only 42 // the X server occurs at SetSource() time. Calling UsePixbuf() should only
40 // be done once as it clears cached data from the X server. 43 // be done once as it clears cached data from the X server.
41 void UsePixbuf(GdkPixbuf* pixbuf); 44 void UsePixbuf(GdkPixbuf* pixbuf);
42 45
43 // Sets our pixbuf as the active surface starting at (x, y), uploading it in 46 // Sets our pixbuf as the active surface starting at (x, y), uploading it in
44 // case we don't have an X backed surface cached. 47 // case we don't have an X backed surface cached.
45 void SetSource(cairo_t* cr, int x, int y); 48 void SetSource(cairo_t* cr, int x, int y);
46 49
50 // Performs a mask operation, using this surface as the alpha channel.
51 void MaskSource(cairo_t* cr, int x, int y);
52
47 // Raw access to the pixbuf. May be NULL. Used for a few gdk operations 53 // Raw access to the pixbuf. May be NULL. Used for a few gdk operations
48 // regarding window shaping. 54 // regarding window shaping.
49 GdkPixbuf* pixbuf() { return pixbuf_; } 55 GdkPixbuf* pixbuf() { return pixbuf_; }
50 56
51 private: 57 private:
58 // Makes sure |surface_| is a valid thing that lives on the X server,
59 // uploading it if necessary.
60 void EnsureSurfaceValid(cairo_t* cr);
61
52 // The source pixbuf. 62 // The source pixbuf.
53 GdkPixbuf* pixbuf_; 63 GdkPixbuf* pixbuf_;
54 64
55 // Our cached surface. This should be a xlib surface so the data lives on the 65 // Our cached surface. This should be a xlib surface so the data lives on the
56 // server instead of on the client. 66 // server instead of on the client.
57 cairo_surface_t* surface_; 67 cairo_surface_t* surface_;
58 }; 68 };
59 69
60 #endif // CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_ 70 #endif // CHROME_BROWSER_UI_GTK_CAIRO_CACHED_SURFACE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/cairo_cached_surface.cc » ('j') | chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698