summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/cairo_cached_surface.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 01:12:19 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 01:12:19 +0000
commit6230e20618e551669580a27cb9e2cd1af7f83d46 (patch)
treea1ce6bcef9a5421cf3c98a19038bfff88e306095 /chrome/browser/gtk/cairo_cached_surface.cc
parent20515f1cf7b19b471740bd98fb7b9818f327cd8c (diff)
downloadchromium_src-6230e20618e551669580a27cb9e2cd1af7f83d46.zip
chromium_src-6230e20618e551669580a27cb9e2cd1af7f83d46.tar.gz
chromium_src-6230e20618e551669580a27cb9e2cd1af7f83d46.tar.bz2
Revert "Upload GdkPixbufs into cairo surfaces so they (hopefully) live on the X
server and have better performance. In the presence of XRender, let cairo do things smarter." Valgrind problems. This reverts commit 03871714c3e5b39ee0f8369ecc2313c02fe0ca08 (r25814). Review URL: http://codereview.chromium.org/200071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/cairo_cached_surface.cc')
-rw-r--r--chrome/browser/gtk/cairo_cached_surface.cc68
1 files changed, 0 insertions, 68 deletions
diff --git a/chrome/browser/gtk/cairo_cached_surface.cc b/chrome/browser/gtk/cairo_cached_surface.cc
deleted file mode 100644
index 90e0ae4..0000000
--- a/chrome/browser/gtk/cairo_cached_surface.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2009 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.
-
-#include "chrome/browser/gtk/cairo_cached_surface.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-CairoCachedSurface::CairoCachedSurface() : pixbuf_(NULL), surface_(NULL) {
-}
-
-CairoCachedSurface::~CairoCachedSurface() {
- if (surface_)
- cairo_surface_destroy(surface_);
-
- if (pixbuf_)
- g_object_unref(pixbuf_);
-}
-
-int CairoCachedSurface::Width() const {
- return pixbuf_ ? gdk_pixbuf_get_width(pixbuf_) : -1;
-}
-
-int CairoCachedSurface::Height() const {
- return pixbuf_ ? gdk_pixbuf_get_height(pixbuf_) : -1;
-}
-
-void CairoCachedSurface::UsePixbuf(GdkPixbuf* pixbuf) {
- if (surface_) {
- cairo_surface_destroy(surface_);
- surface_ = NULL;
- }
-
- if (pixbuf)
- g_object_ref(pixbuf);
-
- if (pixbuf_)
- g_object_unref(pixbuf_);
-
- pixbuf_ = pixbuf;
-}
-
-void CairoCachedSurface::SetSource(cairo_t* cr, int x, int y) {
- DCHECK(pixbuf_);
- DCHECK(cr);
-
- if (!surface_) {
- // First time here since last UsePixbuf call. Generate the surface.
- cairo_surface_t* target = cairo_get_target(cr);
- surface_ = cairo_surface_create_similar(
- target,
- CAIRO_CONTENT_COLOR_ALPHA,
- gdk_pixbuf_get_width(pixbuf_),
- gdk_pixbuf_get_height(pixbuf_));
-
- DCHECK(surface_);
- DCHECK(cairo_surface_get_type(surface_) == CAIRO_SURFACE_TYPE_XLIB ||
- cairo_surface_get_type(surface_) == CAIRO_SURFACE_TYPE_XCB);
-
- cairo_t* copy_cr = cairo_create(surface_);
- gdk_cairo_set_source_pixbuf(copy_cr, pixbuf_, 0, 0);
- cairo_paint(copy_cr);
- cairo_destroy(copy_cr);
- }
-
- cairo_set_source_surface(cr, surface_, x, y);
-}