| 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 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) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| OLD | NEW |