If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Optimize DrawTargetSkia::MaskSurface

NEW
Assigned to

Status

()

Core
Graphics
4 years ago
4 years ago

People

(Reporter: gal, Assigned: gal)

Tracking

Trunk
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Assignee)

Description

4 years ago
+++ This bug was initially created as a clone of Bug #933567 +++

mattwoodrow:

I think the best way to implement MaskSurface will be to use the secret features of drawBitmap().

drawBitmap normally draws the passed bitmap as a source, unless the bitmap is a8, in which case it will use the bitmap as a mask and use the SkPaint to decide the source.

Most of the time we should already have a8 bitmap as the mask surface, but we can call SkBitmap::extractAlpha() if we get some other sort of source.

Then the implementation should be more or less identical to FillRect() except passing mask, aOffset.x, aOffset.y instead of aRect.
(Assignee)

Comment 1

4 years ago
Created attachment 825723 [details] [diff] [review]
Part 1: Factor out PaintSurface
Assignee: nobody → gal
(Assignee)

Comment 2

4 years ago
Created attachment 825724 [details] [diff] [review]
Part 2: Change SourceSurfaceSkia::InitFromCanvas to InitFromBitmap
(Assignee)

Comment 3

4 years ago
Created attachment 825725 [details] [diff] [review]
Part 3: Optimize MaskSurface
(Assignee)

Updated

4 years ago
Depends on: 933584
(Assignee)

Updated

4 years ago
Attachment #825723 - Flags: review?(matt.woodrow)
(Assignee)

Updated

4 years ago
Attachment #825724 - Flags: review?(matt.woodrow)
(Assignee)

Updated

4 years ago
Attachment #825725 - Flags: review?(matt.woodrow)
Comment on attachment 825723 [details] [diff] [review]
Part 1: Factor out PaintSurface

Review of attachment 825723 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/2d/DrawTargetSkia.cpp
@@ +328,5 @@
>  
>    SkRect sourceBoundingRect = RectToSkRect(boundingSource);
>    SkIRect sourceBoundingIRect = RectToSkIRect(boundingSource);
>  
> +  const SkBitmap& bitmap = static_cast<SourceSurfaceSkia*>(static_cast<SourceSurface*>(surface))->GetBitmap();

The inner static_cast should just be surface.get()
Attachment #825723 - Flags: review?(matt.woodrow) → review+
Attachment #825724 - Flags: review?(matt.woodrow) → review+
Comment on attachment 825725 [details] [diff] [review]
Part 3: Optimize MaskSurface

Review of attachment 825725 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, as long as it works!
Attachment #825725 - Flags: review?(matt.woodrow) → review+
You need to log in before you can comment on or make changes to this bug.