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

Side by Side Diff: tools/telemetry/telemetry/core/chrome/png_bitmap.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 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 import sys 4 import sys
5 import os 5 import os
6 import base64 6 import base64
7 7
8 PNG_PATH = os.path.join(os.path.dirname(__file__), '../third_party/png') 8 PNG_PATH = os.path.join(os.path.dirname(__file__), '../../../third_party/png')
9 if PNG_PATH not in sys.path: 9 if PNG_PATH not in sys.path:
10 sys.path.append(PNG_PATH) 10 sys.path.append(PNG_PATH)
11 11
12 import png # pylint: disable=F0401 12 import png # pylint: disable=F0401
13 13
14 class PngColor(object): 14 class PngColor(object):
15 """Encapsulates an RGB color retreived from a PngBitmap""" 15 """Encapsulates an RGB color retreived from a PngBitmap"""
16 16
17 def __init__(self, r, g, b, a=255): 17 def __init__(self, r, g, b, a=255):
18 self.r = r 18 self.r = r
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 def GetPixelColor(self, x, y): 61 def GetPixelColor(self, x, y):
62 """Returns a PngColor for the pixel at (x, y)""" 62 """Returns a PngColor for the pixel at (x, y)"""
63 row = self._pixels[y] 63 row = self._pixels[y]
64 offset = x * 4 64 offset = x * 4
65 return PngColor(row[offset], row[offset+1], row[offset+2], row[offset+3]) 65 return PngColor(row[offset], row[offset+1], row[offset+2], row[offset+3])
66 66
67 def WriteFile(self, path): 67 def WriteFile(self, path):
68 with open(path, "wb") as f: 68 with open(path, "wb") as f:
69 f.write(self._png_data) 69 f.write(self._png_data)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/chrome/platform.py ('k') | tools/telemetry/telemetry/core/chrome/png_bitmap_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698