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

Unified Diff: base/gfx/bitmap_platform_device_linux.cc

Issue 8839: * Revert "Start writing the GTK code for test_shell." (Closed)
Patch Set: Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/gfx/bitmap_platform_device_linux.h ('k') | base/gfx/platform_canvas_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/gfx/bitmap_platform_device_linux.cc
diff --git a/base/gfx/bitmap_platform_device_linux.cc b/base/gfx/bitmap_platform_device_linux.cc
index 05696093280051db1a471d824e1da48b587f565f..171f6b9853c0d93f8a4ceedc84623f92c479633a 100644
--- a/base/gfx/bitmap_platform_device_linux.cc
+++ b/base/gfx/bitmap_platform_device_linux.cc
@@ -6,8 +6,7 @@
#include "base/logging.h"
-#include "gdk/gdk.h"
-#include "gdk-pixbuf/gdk-pixbuf.h"
+#include <time.h>
namespace gfx {
@@ -17,39 +16,26 @@ namespace gfx {
// data.
BitmapPlatformDeviceLinux* BitmapPlatformDeviceLinux::Create(
int width, int height, bool is_opaque) {
- GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, width, height);
- if (!pixbuf)
- return NULL;
-
- DCHECK_EQ(gdk_pixbuf_get_colorspace(pixbuf), GDK_COLORSPACE_RGB);
- DCHECK_EQ(gdk_pixbuf_get_bits_per_sample(pixbuf), 8);
- DCHECK(gdk_pixbuf_get_has_alpha(pixbuf));
- DCHECK_EQ(gdk_pixbuf_get_n_channels(pixbuf), 4);
- DCHECK_EQ(gdk_pixbuf_get_width(pixbuf), width);
- DCHECK_EQ(gdk_pixbuf_get_height(pixbuf), height);
-
SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height,
- gdk_pixbuf_get_rowstride(pixbuf));
- bitmap.setPixels(gdk_pixbuf_get_pixels(pixbuf));
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
bitmap.setIsOpaque(is_opaque);
-#ifndef NDEBUG
if (is_opaque) {
+#ifndef NDEBUG
+ // To aid in finding bugs, we set the background color to something
+ // obviously wrong so it will be noticable when it is not cleared
bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green
- }
#endif
+ }
// The device object will take ownership of the graphics context.
- return new BitmapPlatformDeviceLinux(bitmap, pixbuf);
+ return new BitmapPlatformDeviceLinux(bitmap);
}
// The device will own the bitmap, which corresponds to also owning the pixel
// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
-BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(const SkBitmap& bitmap,
- GdkPixbuf* pixbuf)
- : PlatformDeviceLinux(bitmap),
- pixbuf_(pixbuf) {
+BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(const SkBitmap& bitmap)
+ : PlatformDeviceLinux(bitmap) {
}
BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(
@@ -59,10 +45,6 @@ BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(
}
BitmapPlatformDeviceLinux::~BitmapPlatformDeviceLinux() {
- if (pixbuf_) {
- g_object_unref(pixbuf_);
- pixbuf_ = NULL;
- }
}
} // namespace gfx
« no previous file with comments | « base/gfx/bitmap_platform_device_linux.h ('k') | base/gfx/platform_canvas_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698