New issue
Advanced search Search tips

Issue 882507 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome
Pri: 2
Type: Bug

Blocked on:
issue 891469



Sign in to add a comment

ImageSkia should support drawables instead of only rasterized bitmaps

Project Member Reported by malaykeshav@chromium.org, Sep 10

Issue description

Currently ImageSkia is used as a rasterized image source in the code base. This assumption is used throughout the code base leading to early rasterization of the images on the UI thread. This also means the UI needs to be aware of the current device scale which is cc's job.

ImageSkia should support drawables, which can delay the rasterization of vector images & icons to the cc worker threads (or even the GPU with OOPR). This will also hand over cc the control for scaling the images and offload rasterization task away from the UI thread. It will also allow any image source backed by a drawable to be added with ease (Skottie, SVG, current .icon format, any other vector image source).
 
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 2

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6

commit e8c63be9d5d6eb72cef5ef75e5392717c6be42d6
Author: Malay Keshav <malaykeshav@chromium.org>
Date: Tue Oct 02 00:12:24 2018

Rename sk_bitmap to GetBitmap for ImageSkiaRep

This patch changes the accessor name from sk_bitmap() to GetBitmap. This
is done to prepare for the addition of Paint records which will require
a non inline function.

Bug:  882507 
Change-Id: I3e05ec775d8978461b7e68e585a5eb9d8e2fbb16
Component: ImageSkiaRep, Bitmap, ui
Reviewed-on: https://chromium-review.googlesource.com/1255901
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Greg Kerr <kerrnel@chromium.org>
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595659}
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ash/display/cursor_window_controller.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ash/drag_drop/drag_image_view.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ash/login/ui/horizontal_image_sequence_animation_decoder.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ash/wallpaper/wallpaper_controller_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ash/wallpaper/wallpaper_utils/wallpaper_resizer.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/android/ntp/android_content_suggestions_notifier.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/android/tab_android.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/chromeos/file_manager/crostini_file_tasks.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/chromeos/login/users/wallpaper_policy_browsertest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/api/downloads/downloads_api.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/chrome_app_icon_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/extension_action.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/extension_action_icon_factory_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/extension_action_storage_manager.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/extension_install_prompt.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/extensions/extension_web_ui.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/sync/test/integration/bookmarks_helper.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/themes/browser_theme_pack.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/themes/browser_theme_pack_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/app_list/md_icon_normalizer.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/app_list/search/launcher_search/launcher_search_icon_image_loader_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/extensions/icon_with_badge_image_source.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/views/toolbar/app_menu.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/webui/chromeos/user_image_source.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/webui/fileicon_source.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/ui/webui/theme_source.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/chrome/browser/win/jumplist.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/components/arc/intent_helper/activity_icon_loader.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/components/favicon/core/favicon_service_impl.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/components/favicon_base/favicon_util.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/components/favicon_base/select_favicon_frames_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/content/renderer/pepper/pepper_plugin_instance_impl.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/extensions/browser/extension_icon_image_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/aura/mus/property_converter.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/base/cursor/cursor_util.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/compositor/layer.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_generic.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_mac_unittest.mm
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_skia.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_skia_operations.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_skia_rep.h
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_skia_util_ios.mm
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_skia_util_mac.mm
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_unittest_util.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/image_util.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/mojo/image_skia_struct_traits.h
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/gfx/image/mojo/image_traits_unittest.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/views/controls/image_view.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/views/mus/mus_client.cc
[modify] https://crrev.com/e8c63be9d5d6eb72cef5ef75e5392717c6be42d6/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Blockedon: 891469
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/213fa2881af637b5d9d37bdf0d960f79fecaf77e

commit 213fa2881af637b5d9d37bdf0d960f79fecaf77e
Author: Malay Keshav <malaykeshav@chromium.org>
Date: Wed Oct 03 22:31:38 2018

Use paint record to back ImageSkiaRep

Currently ImageSkiaReps are backed by SkBitmaps and cc::PaintImages.
While cc::PaintImages are drawables, they are sourced from the SkBitmaps
provided to the constructor. This means images that are sourced from
drawables, such as our vector icons, are rasterized into bitmaps first
and then stored as ImageSkiaReps. This rasterization takes place on the
UI thread.

This patch makes cc::PaintRecord as the backing store for ImageSkiaReps.
cc::PaintRecord are drawables and can be initialized with an SkBitmap if
needed. Having images stored this way means drawables like vector icons
dont need to be rasterized on the UI thread. Their rasterization will be
managed by cc or even the GPU in case of OOPR. This also removes the
constraint that ImageSkias are a rasterized source of image. It also
gives a way to add more drawable sources(CanvasImageSources) like
lottie.

This feature is hidden behind a feature flag UsePaintRecordForImageSkia.

Bug:  882507 
Change-Id: Id4a6500ba0e12da382e95d59e5fa8bc5642082ab
Component: ImageSkiaRep, gfx, Image, Image Skia
Reviewed-on: https://chromium-review.googlesource.com/c/1227488
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Khushal <khushalsagar@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596402}
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/BUILD.gn
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/canvas.cc
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/canvas_image_source.cc
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia.cc
[delete] https://crrev.com/cbb05f39a783e3bdaecef9c5c1c5b07b6827abb2/ui/gfx/image/image_skia_rep.cc
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia_rep.h
[add] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia_rep_default.cc
[add] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia_rep_default.h
[add] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia_rep_ios.cc
[add] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/image/image_skia_rep_ios.h
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/skia_paint_util.cc
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/switches.cc
[modify] https://crrev.com/213fa2881af637b5d9d37bdf0d960f79fecaf77e/ui/gfx/switches.h

Status: Fixed (was: Assigned)

Sign in to add a comment