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

Unified Diff: tools/telemetry/telemetry/core/bitmaptools/__init__.py

Issue 121493004: [telemetry] Implement per-pixel algorithms in Bitmap as a C++ extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 6 years, 11 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
Index: tools/telemetry/telemetry/core/bitmaptools/__init__.py
diff --git a/tools/telemetry/telemetry/core/bitmaptools/__init__.py b/tools/telemetry/telemetry/core/bitmaptools/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e6bb7a8a49a4b93d08079a0eedffa953b10dd633
--- /dev/null
+++ b/tools/telemetry/telemetry/core/bitmaptools/__init__.py
@@ -0,0 +1,38 @@
+# Copyright 2014 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.
+
+""" Bitmap processing routines.
+
+All functions accept a tuple of (pixels, width, channels) as the first argument.
+Bounding box is a tuple (left, right, width, height).
+"""
+
+import imp
+import os
+import sys
+
+from telemetry.core import build_extension, util
+
+
+def _BuildModule(module_name):
+ # Build the extension for telemetry users who don't use all.gyp.
+ path = os.path.dirname(__file__)
+ src_files = [os.path.join(path, 'bitmaptools.cc')]
+ build_extension.BuildExtension(src_files, path, module_name)
+ return imp.find_module(module_name, [path])
+
+
+def _FindAndImport():
+ found = util.FindSupportModule('bitmaptools')
+ if not found:
+ found = _BuildModule('bitmaptools')
+ if not found:
+ raise NotImplementedError('The bitmaptools module is not available.')
+ return imp.load_module('bitmaptools', *found)
+
+
+sys.modules['bitmaptools_ext'] = _FindAndImport()
+
+# pylint: disable=W0401,F0401
+from bitmaptools_ext import *
« no previous file with comments | « tools/telemetry/telemetry/core/bitmap_unittest.py ('k') | tools/telemetry/telemetry/core/bitmaptools/bitmaptools.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698