Closed Bug 892964 Opened 11 years ago Closed 11 years ago

Rewrite DrawTargetCG::MaskSurface to avoid using FillRect()

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: jrmuizel, Assigned: jrmuizel)

Details

Attachments

(1 file)

With FillRect we were setting the transform twice.

The patch looks really bad because I needed to move the implementation of MaskSurface so that it was below the helper methods. 

The actual change is:

-  FillRect(Rect(aOffset.x, aOffset.y, size.width, size.height), aSource, aDrawOptions);
-
+  if (isGradient(aSource)) {
+    // we shouldn't need to clip to an additional rectangle
+    // as the cliping to the mask should be sufficient.
+    DrawGradient(cg, aSource);
+  } else {
+    SetFillFromPattern(cg, mColorSpace, aSource);
+    CGContextFillRect(cg, CGRectMake(aOffset.x, aOffset.y, size.width, size.height));
+  }

This also avoids setting up other state like alpha and the unboundness fixer twice.
Attachment #774624 - Flags: review?(matt.woodrow)
Attachment #774624 - Flags: review?(matt.woodrow) → review+
https://hg.mozilla.org/mozilla-central/rev/6a859782966e
Assignee: nobody → jmuizelaar
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: