| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/libgtkui/skia_utils_gtk.h" | 5 #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 } else { | 80 } else { |
| 81 NOTREACHED(); | 81 NOTREACHED(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 return ret; | 84 return ret; |
| 85 } | 85 } |
| 86 | 86 |
| 87 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap) { | 87 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap) { |
| 88 if (bitmap.isNull()) | 88 if (bitmap.isNull()) |
| 89 return NULL; | 89 return nullptr; |
| 90 | 90 |
| 91 SkAutoLockPixels lock_pixels(bitmap); | 91 SkAutoLockPixels lock_pixels(bitmap); |
| 92 | 92 |
| 93 int width = bitmap.width(); | 93 int width = bitmap.width(); |
| 94 int height = bitmap.height(); | 94 int height = bitmap.height(); |
| 95 | 95 |
| 96 GdkPixbuf* pixbuf = | 96 GdkPixbuf* pixbuf = |
| 97 gdk_pixbuf_new(GDK_COLORSPACE_RGB, // The only colorspace gtk supports. | 97 gdk_pixbuf_new(GDK_COLORSPACE_RGB, // The only colorspace gtk supports. |
| 98 TRUE, // There is an alpha channel. | 98 TRUE, // There is an alpha channel. |
| 99 8, width, height); | 99 8, width, height); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 divided[i + 3] = alpha; | 120 divided[i + 3] = alpha; |
| 121 } | 121 } |
| 122 i += kBytesPerPixel; | 122 i += kBytesPerPixel; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 return pixbuf; | 126 return pixbuf; |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace libgtkui | 129 } // namespace libgtkui |
| OLD | NEW |