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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 // claims to support alpha or not. | 1219 // claims to support alpha or not. |
1220 for (int i = 0; i < image->width * image->height * 4; i += 4) | 1220 for (int i = 0; i < image->width * image->height * 4; i += 4) |
1221 image->data[i + 3] = 0xff; | 1221 image->data[i + 3] = 0xff; |
1222 | 1222 |
1223 SkBitmap bitmap; | 1223 SkBitmap bitmap; |
1224 bitmap.setConfig(SkBitmap::kARGB_8888_Config, | 1224 bitmap.setConfig(SkBitmap::kARGB_8888_Config, |
1225 image->width, image->height, | 1225 image->width, image->height, |
1226 image->bytes_per_line); | 1226 image->bytes_per_line); |
1227 bitmap.setPixels(image->data); | 1227 bitmap.setPixels(image->data); |
1228 gfx::ImageSkia image_skia; | 1228 gfx::ImageSkia image_skia; |
1229 gfx::ImageSkiaRep image_rep(bitmap, canvas->image_scale()); | 1229 gfx::ImageSkiaRep image_rep(bitmap, canvas->scale_factor()); |
1230 image_skia.AddRepresentation(image_rep); | 1230 image_skia.AddRepresentation(image_rep); |
1231 canvas->DrawImageInt(image_skia, dest_offset.x(), dest_offset.y()); | 1231 canvas->DrawImageInt(image_skia, dest_offset.x(), dest_offset.y()); |
1232 } else { | 1232 } else { |
1233 NOTIMPLEMENTED() << "Unsupported bits-per-pixel " << image->bits_per_pixel; | 1233 NOTIMPLEMENTED() << "Unsupported bits-per-pixel " << image->bits_per_pixel; |
1234 return false; | 1234 return false; |
1235 } | 1235 } |
1236 | 1236 |
1237 return true; | 1237 return true; |
1238 } | 1238 } |
1239 | 1239 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1724 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1725 << "minor_code " << static_cast<int>(error_event.minor_code) | 1725 << "minor_code " << static_cast<int>(error_event.minor_code) |
1726 << " (" << request_str << ")"; | 1726 << " (" << request_str << ")"; |
1727 } | 1727 } |
1728 | 1728 |
1729 // ---------------------------------------------------------------------------- | 1729 // ---------------------------------------------------------------------------- |
1730 // End of x11_util_internal.h | 1730 // End of x11_util_internal.h |
1731 | 1731 |
1732 | 1732 |
1733 } // namespace ui | 1733 } // namespace ui |
OLD | NEW |