Skip to content
Permalink
Browse files
Fix layering violations in GraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=30986

Reviewed by Darin Adler.

Remove uses of HTMLImageElement and HTMLCanvasElement

Canonical link: https://commits.webkit.org/41827@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50394 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ojhunt committed Nov 1, 2009
1 parent c8f04de commit 966e02e441e1039e708cb9bb54e6c4c11cd7badd
Showing 4 changed files with 69 additions and 61 deletions.
@@ -1,3 +1,20 @@
2009-10-31 Oliver Hunt <oliver@apple.com>

Reviewed by Darin Adler.

Fix layering violations in GraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=30986

Remove uses of HTMLImageElement and HTMLCanvasElement

* html/canvas/CanvasRenderingContext3D.cpp:
(WebCore::CanvasRenderingContext3D::texImage2D):
(WebCore::CanvasRenderingContext3D::texSubImage2D):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/mac/GraphicsContext3DMac.cpp:
(WebCore::GraphicsContext3D::texImage2D):
(WebCore::GraphicsContext3D::texSubImage2D):

2009-11-01 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Jan Alonzo.
@@ -37,6 +37,8 @@
#include "CanvasTexture.h"
#include "CanvasShader.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
#include "ImageBuffer.h"
#include "RenderBox.h"
#include "RenderLayer.h"

@@ -1005,18 +1007,36 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig
void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLImageElement* image,
bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
{
// FIXME: For now we ignore any errors returned
ec = 0;
m_context->texImage2D(target, level, image, flipY, premultiplyAlpha);
if (!image) {
ec = TYPE_MISMATCH_ERR;
return;
}

CachedImage* cachedImage = image->cachedImage();
if (!cachedImage)
return;

// FIXME: For now we ignore any errors returned
m_context->texImage2D(target, level, cachedImage->image(), flipY, premultiplyAlpha);
cleanupAfterGraphicsCall(false);
}

void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas,
bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
{
// FIXME: For now we ignore any errors returned
ec = 0;
m_context->texImage2D(target, level, canvas, flipY, premultiplyAlpha);
if (!canvas) {
ec = TYPE_MISMATCH_ERR;
return;
}

ImageBuffer* buffer = canvas->buffer();
if (!buffer)
return;

// FIXME: For now we ignore any errors returned
m_context->texImage2D(target, level, buffer->image(), flipY, premultiplyAlpha);
cleanupAfterGraphicsCall(false);
}

@@ -1067,17 +1087,35 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un
{
// FIXME: For now we ignore any errors returned
ec = 0;
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha);
if (!image) {
ec = TYPE_MISMATCH_ERR;
return;
}

CachedImage* cachedImage = image->cachedImage();
if (!cachedImage)
return;

m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, cachedImage->image(), flipY, premultiplyAlpha);
cleanupAfterGraphicsCall(false);
}

void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
unsigned width, unsigned height, HTMLCanvasElement* canvas,
bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
{
// FIXME: For now we ignore any errors returned
ec = 0;
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha);
if (!canvas) {
ec = TYPE_MISMATCH_ERR;
return;
}

ImageBuffer* buffer = canvas->buffer();
if (!buffer)
return;

// FIXME: For now we ignore any errors returned
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, buffer->image(), flipY, premultiplyAlpha);
cleanupAfterGraphicsCall(false);
}

@@ -58,8 +58,7 @@ namespace WebCore {
class CanvasRenderingContext3D;
class CanvasShader;
class CanvasTexture;
class HTMLCanvasElement;
class HTMLImageElement;
class Image;
class HTMLVideoElement;
class ImageData;
class WebKitCSSMatrix;
@@ -236,9 +235,7 @@ namespace WebCore {
int texImage2D(unsigned target, unsigned level, unsigned internalformat,
unsigned width, unsigned height, unsigned border,
unsigned format, unsigned type, ImageData* pixels);
int texImage2D(unsigned target, unsigned level, HTMLImageElement* image,
bool flipY, bool premultiplyAlpha);
int texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas,
int texImage2D(unsigned target, unsigned level, Image* image,
bool flipY, bool premultiplyAlpha);
int texImage2D(unsigned target, unsigned level, HTMLVideoElement* video,
bool flipY, bool premultiplyAlpha);
@@ -253,10 +250,7 @@ namespace WebCore {
unsigned width, unsigned height,
unsigned format, unsigned type, ImageData* pixels);
int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
unsigned width, unsigned height, HTMLImageElement* image,
bool flipY, bool premultiplyAlpha);
int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
unsigned width, unsigned height, HTMLCanvasElement* canvas,
unsigned width, unsigned height, Image* image,
bool flipY, bool premultiplyAlpha);
int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
unsigned width, unsigned height, HTMLVideoElement* video,
@@ -1568,39 +1568,15 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, unsigned inte
return -1;
}

int GraphicsContext3D::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha)
int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha)
{
// FIXME: need to support flipY and premultiplyAlpha
UNUSED_PARAM(flipY);
UNUSED_PARAM(premultiplyAlpha);

if (!image)
return -1;
ASSERT(image);

ensureContext(m_contextObj);
CachedImage* cachedImage = image->cachedImage();
if (!cachedImage)
return -1;

imageToTexture(cachedImage->image(), target, level);
return 0;
}

int GraphicsContext3D::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha)
{
// FIXME: need to support flipY and premultiplyAlpha
UNUSED_PARAM(flipY);
UNUSED_PARAM(premultiplyAlpha);

if (!canvas)
return -1;

ensureContext(m_contextObj);
ImageBuffer* buffer = canvas->buffer();
if (!buffer)
return -1;

imageToTexture(buffer->image(), target, level);
imageToTexture(image, target, level);
return 0;
}

@@ -1647,7 +1623,7 @@ int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned x
return -1;
}

int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLImageElement* image, bool flipY, bool premultiplyAlpha)
int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, Image* image, bool flipY, bool premultiplyAlpha)
{
// FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size
UNUSED_PARAM(target);
@@ -1664,23 +1640,6 @@ int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned x
return -1;
}

int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha)
{
// FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size
UNUSED_PARAM(target);
UNUSED_PARAM(level);
UNUSED_PARAM(xoff);
UNUSED_PARAM(yoff);
UNUSED_PARAM(width);
UNUSED_PARAM(height);
UNUSED_PARAM(canvas);

// FIXME: need to support flipY and premultiplyAlpha
UNUSED_PARAM(flipY);
UNUSED_PARAM(premultiplyAlpha);
return -1;
}

int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha)
{
// FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size

0 comments on commit 966e02e

Please sign in to comment.