Changeset 83745 in webkit


Ignore:
Timestamp:
Apr 13, 2011 9:17:37 AM (13 years ago)
Author:
Martin Robinson
Message:

2011-04-13 Thierry Reding <thierry.reding@avionic-design.de>

Gtk+ port fails to build when enabling WebGL
https://bugs.webkit.org/show_bug.cgi?id=58434

Fix the GTK+ WebGL build after the introduction of PlatformContextCairo.

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/cairo/GraphicsContext3DCairo.cpp: (WebCore::GraphicsContext3D::paintToCanvas):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83741 r83745  
     12011-04-13  Thierry Reding  <thierry.reding@avionic-design.de>
     2
     3        Gtk+ port fails to build when enabling WebGL
     4        https://bugs.webkit.org/show_bug.cgi?id=58434
     5
     6        Fix the GTK+ WebGL build after the introduction of PlatformContextCairo.
     7
     8        * platform/graphics/GraphicsContext3D.h:
     9        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
     10        (WebCore::GraphicsContext3D::paintToCanvas):
     11
    1122011-04-12  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r82878 r83745  
    6464QT_END_NAMESPACE
    6565#elif PLATFORM(GTK)
    66 typedef struct _cairo cairo_t;
    6766typedef unsigned int GLuint;
    6867#endif
     
    9291class Image;
    9392class ImageData;
     93#if PLATFORM(CAIRO)
     94class PlatformContextCairo;
     95#endif
    9496
    9597struct ActiveInfo {
     
    766768#elif PLATFORM(GTK)
    767769    void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
    768                        int canvasWidth, int canvasHeight, cairo_t* context);
     770                       int canvasWidth, int canvasHeight, PlatformContextCairo* context);
    769771#endif
    770772
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp

    r82878 r83745  
    2828#include "config.h"
    2929#include "GraphicsContext3D.h"
     30#include "PlatformContextCairo.h"
    3031
    3132#if ENABLE(WEBGL)
     
    8485}
    8586
    86 void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, cairo_t* context)
     87void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, PlatformContextCairo* context)
    8788{
    8889    if (!imagePixels || imageWidth <= 0 || imageHeight <= 0 || canvasWidth <= 0 || canvasHeight <= 0 || !context)
    8990        return;
    9091
    91     cairo_save(context);
     92    cairo_t *cr = context->cr();
     93    context->save();
    9294
    93     cairo_rectangle(context, 0, 0, canvasWidth, canvasHeight);
    94     cairo_set_operator(context, CAIRO_OPERATOR_CLEAR);
    95     cairo_paint(context);
     95    cairo_rectangle(cr, 0, 0, canvasWidth, canvasHeight);
     96    cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
     97    cairo_paint(cr);
    9698
    9799    RefPtr<cairo_surface_t> imageSurface = adoptRef(cairo_image_surface_create_for_data(
     
    99101
    100102    // OpenGL keeps the pixels stored bottom up, so we need to flip the image here.
    101     cairo_translate(context, 0, imageHeight);
    102     cairo_scale(context, 1, -1);
     103    cairo_translate(cr, 0, imageHeight);
     104    cairo_scale(cr, 1, -1);
    103105
    104     cairo_set_operator(context, CAIRO_OPERATOR_OVER);
    105     cairo_set_source_surface(context, imageSurface.get(), 0, 0);
    106     cairo_rectangle(context, 0, 0, canvasWidth, -canvasHeight);
     106    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
     107    cairo_set_source_surface(cr, imageSurface.get(), 0, 0);
     108    cairo_rectangle(cr, 0, 0, canvasWidth, -canvasHeight);
    107109
    108     cairo_fill(context);
    109     cairo_restore(context);
     110    cairo_fill(cr);
     111    context->restore();
    110112}
    111113
Note: See TracChangeset for help on using the changeset viewer.