<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>80593</bug_id>
          
          <creation_ts>2012-03-08 07:01:55 -0800</creation_ts>
          <short_desc>Unnecessary discard of image buffer with idempotent canvas size change</short_desc>
          <delta_ts>2022-07-18 14:15:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Canvas</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>80871</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tom Hudson">tomhudson</reporter>
          <assigned_to name="Tom Hudson">tomhudson</assigned_to>
          <cc>bfulgham</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>573807</commentid>
    <comment_count>0</comment_count>
    <who name="Tom Hudson">tomhudson</who>
    <bug_when>2012-03-08 07:01:55 -0800</bug_when>
    <thetext>canvas.width = canvas.width has become an accepted shorthand for clearing the canvas.

WebCore::HTMLCanvasElement::parseAttribute() calls reset() every time the width or height is set from JavaScript. That calls setSurfaceSize(), which forcibly throws away the WebCore::ImageBuffer, even when the width or height isn&apos;t actually changing.

Most of the calls in reset() check to make sure that size() != oldSize; if we could extend that to being *all* the calls, we ought to be able to avoid destroying and recreating the ImageBuffer, which has a measurable performance impact on Chromium and may be thrashing textures in the driver for hardware-accelerated canvas rendering.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884860</commentid>
    <comment_count>1</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-07-18 14:15:25 -0700</bug_when>
    <thetext>It looks like this suggestion was done in Bug 80871.

*** This bug has been marked as a duplicate of bug 80871 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>