diff options
author | Ben Wagner <bungeman@google.com> | 2018-06-20 16:34:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-20 21:24:27 +0000 |
commit | 2de15fd06309209e7e900a9314b900ab295b3689 (patch) | |
tree | 651d196ad6203ab6a3a8b626e101ead71878224c /tools/gdb | |
parent | 224796587a5a1ce95ba2e613e1b5433732602f32 (diff) |
Update gdb bitmap viewer.
This updates the gdb bitmap viewer for color enums, SkBitmap layout, and
to work with gdb when using python 2.
Change-Id: Id50048ecd7db5b3febaff15f118d8b8183c7dbf1
Reviewed-on: https://skia-review.googlesource.com/136247
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'tools/gdb')
-rw-r--r-- | tools/gdb/bitmap.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tools/gdb/bitmap.py b/tools/gdb/bitmap.py index e9e18f973e..3df079d247 100644 --- a/tools/gdb/bitmap.py +++ b/tools/gdb/bitmap.py @@ -27,9 +27,12 @@ class ColorType(Enum): rgb_565 = 2 argb_4444 = 3 rgba_8888 = 4 - bgra_8888 = 5 - gray_8 = 6 - rgba_F16 = 7 + rgbx_8888 = 5 + bgra_8888 = 6 + rgba_1010102 = 7 + rgb_101010x = 8 + gray_8 = 9 + rgba_F16 = 10 class AlphaType(Enum): unknown = 0 @@ -49,11 +52,13 @@ class sk_bitmap(gdb.Command): frame = gdb.selected_frame() val = frame.read_var(arg) if str(val.type.strip_typedefs()) == 'SkBitmap': - pixels = val['fPixels'] - row_bytes = val['fRowBytes'] - info = val['fInfo'] - width = info['fWidth'] - height = info['fHeight'] + pixmap = val['fPixmap'] + pixels = pixmap['fPixels'] + row_bytes = pixmap['fRowBytes'] + info = pixmap['fInfo'] + dimensions = info['fDimensions'] + width = dimensions['fWidth'] + height = dimensions['fHeight'] color_type = info['fColorType'] alpha_type = info['fAlphaType'] @@ -64,11 +69,11 @@ class sk_bitmap(gdb.Command): # See Unpack.c for the values understood after the "raw" parameter. if color_type == ColorType.bgra_8888.value: if alpha_type == AlphaType.unpremul.value: - image = Image.frombytes("RGBA", size, memory_data.tobytes(), + image = Image.frombytes("RGBA", size, memory_data, "raw", "BGRA", row_bytes, 1) elif alpha_type == AlphaType.premul.value: # RGBA instead of RGBa, because Image.show() doesn't work with RGBa. - image = Image.frombytes("RGBA", size, memory_data.tobytes(), + image = Image.frombytes("RGBA", size, memory_data, "raw", "BGRa", row_bytes, 1) if image: |