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

Side by Side Diff: ui/base/x/x11_util.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 // claims to support alpha or not. 1232 // claims to support alpha or not.
1233 for (int i = 0; i < image->width * image->height * 4; i += 4) 1233 for (int i = 0; i < image->width * image->height * 4; i += 4)
1234 image->data[i + 3] = 0xff; 1234 image->data[i + 3] = 0xff;
1235 1235
1236 SkBitmap bitmap; 1236 SkBitmap bitmap;
1237 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1237 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
1238 image->width, image->height, 1238 image->width, image->height,
1239 image->bytes_per_line); 1239 image->bytes_per_line);
1240 bitmap.setPixels(image->data); 1240 bitmap.setPixels(image->data);
1241 gfx::ImageSkia image_skia; 1241 gfx::ImageSkia image_skia;
1242 gfx::ImageSkiaRep image_rep(bitmap, canvas->scale_factor()); 1242 gfx::ImageSkiaRep image_rep(bitmap, canvas->image_scale());
1243 image_skia.AddRepresentation(image_rep); 1243 image_skia.AddRepresentation(image_rep);
1244 canvas->DrawImageInt(image_skia, dest_offset.x(), dest_offset.y()); 1244 canvas->DrawImageInt(image_skia, dest_offset.x(), dest_offset.y());
1245 } else { 1245 } else {
1246 NOTIMPLEMENTED() << "Unsupported bits-per-pixel " << image->bits_per_pixel; 1246 NOTIMPLEMENTED() << "Unsupported bits-per-pixel " << image->bits_per_pixel;
1247 return false; 1247 return false;
1248 } 1248 }
1249 1249
1250 return true; 1250 return true;
1251 } 1251 }
1252 1252
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1740 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1741 << "minor_code " << static_cast<int>(error_event.minor_code) 1741 << "minor_code " << static_cast<int>(error_event.minor_code)
1742 << " (" << request_str << ")"; 1742 << " (" << request_str << ")";
1743 } 1743 }
1744 1744
1745 // ---------------------------------------------------------------------------- 1745 // ----------------------------------------------------------------------------
1746 // End of x11_util_internal.h 1746 // End of x11_util_internal.h
1747 1747
1748 1748
1749 } // namespace ui 1749 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698