<?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>32188</bug_id>
          
          <creation_ts>2009-12-05 20:57:36 -0800</creation_ts>
          <short_desc>texImage2D pixel junk for transparency</short_desc>
          <delta_ts>2009-12-06 03:38:11 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.6</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Keith Bauer">OneSadCookie</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>169062</commentid>
    <comment_count>0</comment_count>
    <who name="Keith Bauer">OneSadCookie</who>
    <bug_when>2009-12-05 20:57:36 -0800</bug_when>
    <thetext>When using texImage2D with an Image or Canvas as the source of the data, WebKit draws the underlying CGImage to a CGBitmapContext to get access to the pixels.  The context is created with memory from fastMalloc(), and therefore undefined.  When the CGImage being drawn contains transparency, this undefined data shows through, causing pixel junk in the resulting WebGL texture image.

There is no workaround for this; there is no way to affect the pixels of that CGBitmapContext in such a way that the pixel junk is cleared without also making the resulting texture opaque.

The patch is trivial (using calloc, or adding a memset, or CGClearRect, or similar to zero the bitmap context&apos;s data before drawing the image in imageToTexture() in WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp.  I&apos;m having trouble building WebKit though so I can&apos;t offer a tested patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>169084</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-12-06 02:47:31 -0800</bug_when>
    <thetext>This problem can be fixed by forcing the blend mode to kCGBlendCopy.  Have  a patch in my tree, but haven&apos;t yet worked out how to make a testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>169085</commentid>
    <comment_count>2</comment_count>
      <attachid>44359</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-12-06 03:30:19 -0800</bug_when>
    <thetext>Created attachment 44359
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>169086</commentid>
    <comment_count>3</comment_count>
      <attachid>44359</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2009-12-06 03:33:37 -0800</bug_when>
    <thetext>Comment on attachment 44359
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>169087</commentid>
    <comment_count>4</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-12-06 03:38:11 -0800</bug_when>
    <thetext>Committed r51740</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>44359</attachid>
            <date>2009-12-06 03:30:19 -0800</date>
            <delta_ts>2009-12-06 03:33:36 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-32188-20091206033018.patch</filename>
            <type>text/plain</type>
            <size>1626</size>
            <attacher name="Oliver Hunt">oliver</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
ZjBlOThjNy4uMzMxMTg1YSAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29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0tIGEvV2ViQ29yZS9wbGF0Zm9ybS9ncmFwaGljcy9tYWMvR3JhcGhpY3NDb250ZXh0
M0RNYWMuY3BwCisrKyBiL1dlYkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MvbWFjL0dyYXBoaWNzQ29u
dGV4dDNETWFjLmNwcApAQCAtMTEzMiw3ICsxMTMyLDcgQEAgc3RhdGljIHZvaWQgaW1hZ2VUb1Rl
eHR1cmUoSW1hZ2UqIGltYWdlLCB1bnNpZ25lZCB0YXJnZXQsIHVuc2lnbmVkIGxldmVsKQogICAg
ICAgICAKICAgICBDR0NvbnRleHRSZWYgdGV4dHVyZUNvbnRleHQgPSBDR0JpdG1hcENvbnRleHRD
cmVhdGUodGV4dHVyZURhdGEsIHRleHR1cmVXaWR0aCwgdGV4dHVyZUhlaWdodCwgOCwgdGV4dHVy
ZVdpZHRoICogNCwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgIENHSW1hZ2VHZXRDb2xvclNwYWNlKHRleHR1cmVJbWFnZSksIGtDR0ltYWdl
QWxwaGFQcmVtdWx0aXBsaWVkTGFzdCk7Ci0gICAgCisgICAgQ0dDb250ZXh0U2V0QmxlbmRNb2Rl
KHRleHR1cmVDb250ZXh0LCBrQ0dCbGVuZE1vZGVDb3B5KTsKICAgICBDR0NvbnRleHREcmF3SW1h
Z2UodGV4dHVyZUNvbnRleHQsIENHUmVjdE1ha2UoMCwgMCwgKENHRmxvYXQpdGV4dHVyZVdpZHRo
LCAoQ0dGbG9hdCl0ZXh0dXJlSGVpZ2h0KSwgdGV4dHVyZUltYWdlKTsKICAgICBDR0NvbnRleHRS
ZWxlYXNlKHRleHR1cmVDb250ZXh0KTsKICAgICAK
</data>
<flag name="review"
          id="26192"
          type_id="1"
          status="+"
          setter="mjs"
    />
          </attachment>
      

    </bug>

</bugzilla>