W3C home > Mailing lists > Public > public-html@w3.org > October 2011

[Bug 14499] New: Need ability to reset Canvas clipping region without resetting all other Canvas state

From: <bugzilla@jessica.w3.org>
Date: Tue, 18 Oct 2011 16:37:27 +0000
To: public-html@w3.org
Message-ID: <bug-14499-2495@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=14499

           Summary: Need ability to reset Canvas clipping region without
                    resetting all other Canvas state
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HTML Canvas 2D Context (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: simon.sarris@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


The clipping region is defined such that it can only get smaller and never
larger.   

"The clip() method must create a new clipping region by calculating the
intersection of the current clipping region and the area described by the
current path, using the non-zero winding number rule."

In other words, one cannot define a clipping region of (50,50,50,50) and then
define a larger one of (0,0,200,200). The clipping region will still be
(50,50,50,50).

This rule itself is fine. But if one wants to clip and then reset the clipping
region back to default (the entire canvas) there is currently no way to do that
short of resetting all canvas state, either by changing the size of the canvas
(destroys all state) or using save() and restore().

But there are plenty of reasons for wanting the canvas state to persist
otherwise while resetting the clipping region. Most of them are
performance/caching reasons that can make a significant difference. If one
wanted to draw 7,000 strings with a single font but wanted a different clipping
region for each, one would have to set the font property of the canvas 7,000
times instead of just once. This is murder on performance when it need not be
necessary.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Tuesday, 18 October 2011 16:37:29 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:28 UTC