Changeset 64656 in webkit


Ignore:
Timestamp:
Aug 4, 2010 10:48:02 AM (14 years ago)
Author:
kbr@google.com
Message:

2010-08-02 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

Port Chromium's accelerated compositing to Mac OS X
https://bugs.webkit.org/show_bug.cgi?id=43398

  • public/WebGLES2Context.h:
    • Added resizeOnscreenContent, needed on Mac OS X to report window size changes.
  • src/WebViewImpl.cpp: (WebKit::WebViewImpl::resize):
    • Send resize notification to the WebGLES2Context.

(WebKit::WebViewImpl::updateRootLayerContents):

  • Ported to Core Graphics.

(WebKit::WebViewImpl::gles2Context):

  • Added initial size notification upon context creation.

2010-08-02 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.

Port Chromium's accelerated compositing to Mac OS X
https://bugs.webkit.org/show_bug.cgi?id=43398

No new tests. Tested manually with CSS 3D and WebGL tests.

  • platform/graphics/chromium/GraphicsLayerChromium.cpp: (WebCore::clearBorderColor): (WebCore::clearLayerBackgroundColor):
    • Fixed compilation problems with gcc.
  • platform/graphics/chromium/ImageLayerChromium.cpp: (WebCore::ImageLayerChromium::updateTextureContents):
    • Added Core Graphics port.
  • platform/graphics/chromium/LayerChromium.cpp: (WebCore::LayerChromium::LayerChromium):
    • Fixed compilation problems with gcc related to initialization order of members.

(WebCore::LayerChromium::updateTextureContents):
(WebCore::LayerChromium::updateTextureRect):

  • Ported to Core Graphics, adjusting for lower-left coordinate system origin.
  • platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::LayerRendererChromium):
    • Fixed compilation problems with gcc related to initialization order of members.

(WebCore::LayerRendererChromium::setRootLayerCanvasSize):

  • Ported to Core Graphics.

(WebCore::LayerRendererChromium::drawLayers):

  • Added more debug-only error calls during drawing phase. Adjusted scrolling and incremental updating code for Core Graphics' lower-left coordinate system origin.

(WebCore::LayerRendererChromium::initializeSharedGLObjects):

  • Removed color channel swizzling in Core Graphics port. Fixed preexisting bug in initialization check of m_rootLayerTextureId.
  • platform/graphics/chromium/LayerRendererChromium.h:
    • Added needed data members for Core Graphics port.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64653 r64656  
     12010-08-02  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Port Chromium's accelerated compositing to Mac OS X
     6        https://bugs.webkit.org/show_bug.cgi?id=43398
     7
     8        No new tests. Tested manually with CSS 3D and WebGL tests.
     9
     10        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     11        (WebCore::clearBorderColor):
     12        (WebCore::clearLayerBackgroundColor):
     13         - Fixed compilation problems with gcc.
     14        * platform/graphics/chromium/ImageLayerChromium.cpp:
     15        (WebCore::ImageLayerChromium::updateTextureContents):
     16         - Added Core Graphics port.
     17        * platform/graphics/chromium/LayerChromium.cpp:
     18        (WebCore::LayerChromium::LayerChromium):
     19         - Fixed compilation problems with gcc related to initialization
     20           order of members.
     21        (WebCore::LayerChromium::updateTextureContents):
     22        (WebCore::LayerChromium::updateTextureRect):
     23         - Ported to Core Graphics, adjusting for lower-left coordinate
     24           system origin.
     25        * platform/graphics/chromium/LayerRendererChromium.cpp:
     26        (WebCore::LayerRendererChromium::LayerRendererChromium):
     27         - Fixed compilation problems with gcc related to initialization
     28           order of members.
     29        (WebCore::LayerRendererChromium::setRootLayerCanvasSize):
     30         - Ported to Core Graphics.
     31        (WebCore::LayerRendererChromium::drawLayers):
     32         - Added more debug-only error calls during drawing phase.
     33           Adjusted scrolling and incremental updating code for Core
     34           Graphics' lower-left coordinate system origin.
     35        (WebCore::LayerRendererChromium::initializeSharedGLObjects):
     36         - Removed color channel swizzling in Core Graphics port. Fixed
     37           preexisting bug in initialization check of m_rootLayerTextureId.
     38        * platform/graphics/chromium/LayerRendererChromium.h:
     39         - Added needed data members for Core Graphics port.
     40
    1412010-08-04  Yury Semikhatsky  <yurys@chromium.org>
    242
  • trunk/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r63723 r64656  
    7070static void clearBorderColor(LayerChromium& layer)
    7171{
    72     layer.setBorderColor(0);
     72    layer.setBorderColor(static_cast<RGBA32>(0));
    7373}
    7474
     
    8080static void clearLayerBackgroundColor(LayerChromium& layer)
    8181{
    82     layer.setBackgroundColor(0);
     82    layer.setBackgroundColor(static_cast<RGBA32>(0));
    8383}
    8484
  • trunk/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r61775 r64656  
    3838#include "NativeImageSkia.h"
    3939#include "PlatformContextSkia.h"
     40#endif
     41
     42#if PLATFORM(CG)
     43#include <CoreGraphics/CGBitmapContext.h>
     44#include <CoreGraphics/CGContext.h>
     45#include <CoreGraphics/CGImage.h>
     46#include <wtf/RetainPtr.h>
    4047#endif
    4148
     
    8390        bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
    8491    }
     92#elif PLATFORM(CG)
     93    // NativeImagePtr is a CGImageRef on Mac OS X.
     94    CGImageRef cgImage = m_contents;
     95    int width = CGImageGetWidth(cgImage);
     96    int height = CGImageGetHeight(cgImage);
     97    requiredTextureSize = IntSize(width, height);
     98    bitmapSize = requiredTextureSize;
     99    // FIXME: we should get rid of this temporary copy where possible.
     100    int tempRowBytes = width * 4;
     101    Vector<uint8_t> tempVector;
     102    tempVector.resize(height * tempRowBytes);
     103    // Note we do not zero this vector since we are going to
     104    // completely overwrite its contents with the image below.
     105    // Try to reuse the color space from the image to preserve its colors.
     106    // Some images use a color space (such as indexed) unsupported by the bitmap context.
     107    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGImageGetColorSpace(cgImage));
     108    CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace.get());
     109    switch (colorSpaceModel) {
     110    case kCGColorSpaceModelMonochrome:
     111    case kCGColorSpaceModelRGB:
     112    case kCGColorSpaceModelCMYK:
     113    case kCGColorSpaceModelLab:
     114    case kCGColorSpaceModelDeviceN:
     115        break;
     116    default:
     117        colorSpace.adoptCF(CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
     118        break;
     119    }
     120    RetainPtr<CGContextRef> tempContext(AdoptCF, CGBitmapContextCreate(tempVector.data(),
     121                                                                       width, height, 8, tempRowBytes,
     122                                                                       colorSpace.get(),
     123                                                                       kCGImageAlphaPremultipliedLast));
     124    CGContextSetBlendMode(tempContext.get(), kCGBlendModeCopy);
     125    CGContextDrawImage(tempContext.get(),
     126                       CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
     127                       cgImage);
     128    pixels = tempVector.data();
    85129#else
    86130#error "Need to implement for your platform."
  • trunk/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r62157 r64656  
    5757
    5858LayerChromium::LayerChromium(GraphicsLayerChromium* owner)
    59     : m_needsDisplayOnBoundsChange(false)
    60     , m_owner(owner)
     59    : m_owner(owner)
     60    , m_contentsDirty(false)
    6161    , m_superlayer(0)
     62    , m_anchorPoint(0.5, 0.5)
     63    , m_backgroundColor(0, 0, 0, 0)
     64    , m_borderColor(0, 0, 0, 0)
    6265    , m_layerRenderer(0)
     66    , m_edgeAntialiasingMask(0)
     67    , m_opacity(1.0)
     68    , m_zPosition(0.0)
     69    , m_anchorPointZ(0)
    6370    , m_borderWidth(0)
    6471    , m_allocatedTextureId(0)
    65     , m_borderColor(0, 0, 0, 0)
    66     , m_backgroundColor(0, 0, 0, 0)
    67     , m_anchorPoint(0.5, 0.5)
    68     , m_anchorPointZ(0)
    6972    , m_clearsContext(false)
    7073    , m_doubleSided(true)
    71     , m_edgeAntialiasingMask(0)
    7274    , m_hidden(false)
    7375    , m_masksToBounds(false)
    74     , m_opacity(1.0)
    7576    , m_opaque(true)
    76     , m_zPosition(0.0)
    7777    , m_geometryFlipped(false)
    78     , m_contentsDirty(false)
     78    , m_needsDisplayOnBoundsChange(false)
    7979{
    8080}
     
    163163        bitmapSize = IntSize(skiaBitmap->width(), skiaBitmap->height());
    164164    }
     165#elif PLATFORM(CG)
     166    requiredTextureSize = m_bounds;
     167    IntRect boundsRect(IntPoint(0, 0), m_bounds);
     168
     169    // If the texture needs to be reallocated then we must redraw the entire
     170    // contents of the layer.
     171    if (requiredTextureSize != m_allocatedTextureSize)
     172        dirtyRect = boundsRect;
     173    else {
     174        // Clip the dirtyRect to the size of the layer to avoid drawing outside
     175        // the bounds of the backing texture.
     176        dirtyRect.intersect(boundsRect);
     177    }
     178
     179    Vector<uint8_t> tempVector;
     180    int rowBytes = 4 * dirtyRect.width();
     181    tempVector.resize(rowBytes * dirtyRect.height());
     182    memset(tempVector.data(), 0, tempVector.size());
     183    // FIXME: unsure whether this is the best color space choice.
     184    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
     185    RetainPtr<CGContextRef> contextCG(AdoptCF, CGBitmapContextCreate(tempVector.data(),
     186                                                                     dirtyRect.width(), dirtyRect.height(), 8, rowBytes,
     187                                                                     colorSpace.get(),
     188                                                                     kCGImageAlphaPremultipliedLast));
     189
     190    GraphicsContext graphicsContext(contextCG.get());
     191
     192    // Translate the graphics contxt into the coordinate system of the dirty rect.
     193    graphicsContext.translate(-dirtyRect.x(), -dirtyRect.y());
     194
     195    m_owner->paintGraphicsLayerContents(graphicsContext, dirtyRect);
     196
     197    pixels = tempVector.data();
     198    bitmapSize = dirtyRect.size();
    165199#else
    166200#error "Need to implement for your platform."
     
    188222        ASSERT(updateRect.width() <= m_allocatedTextureSize.width() && updateRect.height() <= m_allocatedTextureSize.height());
    189223        ASSERT(updateRect.width() == bitmapSize.width() && updateRect.height() == bitmapSize.height());
     224#if PLATFORM(CG)
     225        // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
     226        glTexSubImage2D(GL_TEXTURE_2D, 0,
     227                        updateRect.x(), m_allocatedTextureSize.height() - updateRect.height() - updateRect.y(),
     228                        updateRect.width(), updateRect.height(),
     229                        GL_RGBA, GL_UNSIGNED_BYTE, pixels);
     230#elif PLATFORM(SKIA)
    190231        glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
     232#else
     233#error "Need to implement for your platform."
     234#endif
    191235    }
    192236
  • trunk/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r63383 r64656  
    4343#include "NativeImageSkia.h"
    4444#include "PlatformContextSkia.h"
     45#elif PLATFORM(CG)
     46#include <CoreGraphics/CGBitmapContext.h>
    4547#endif
    4648
     
    4951namespace WebCore {
    5052
     53#ifndef NDEBUG
    5154static WTFLogChannel LogLayerRenderer = { 0x00000000, "LayerRenderer", WTFLogChannelOn };
     55#endif
    5256
    5357static void checkGLError()
     
    196200
    197201LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context)
    198     : m_rootLayer(0)
    199     , m_needsDisplay(false)
     202    : m_rootLayerTextureWidth(0)
     203    , m_rootLayerTextureHeight(0)
    200204    , m_positionLocation(0)
    201205    , m_texCoordLocation(1)
    202     , m_rootLayerTextureWidth(0)
    203     , m_rootLayerTextureHeight(0)
     206    , m_rootLayer(0)
     207    , m_needsDisplay(false)
    204208    , m_scrollPosition(IntPoint(-1, -1))
    205209    , m_currentShaderProgramType(NumShaderProgramTypes)
     
    246250#endif
    247251    m_rootLayerGraphicsContext = new GraphicsContext(reinterpret_cast<PlatformGraphicsContext*>(m_rootLayerSkiaContext.get()));
     252#elif PLATFORM(CG)
     253    // Release the previous CGBitmapContext before reallocating the backing store as a precaution.
     254    m_rootLayerCGContext.adoptCF(0);
     255    int rowBytes = 4 * size.width();
     256    m_rootLayerBackingStore.resize(rowBytes * size.height());
     257    memset(m_rootLayerBackingStore.data(), 0, m_rootLayerBackingStore.size());
     258    // FIXME: unsure whether this is the best color space choice.
     259    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear));
     260    m_rootLayerCGContext.adoptCF(CGBitmapContextCreate(m_rootLayerBackingStore.data(),
     261                                                       size.width(), size.height(), 8, rowBytes,
     262                                                       colorSpace.get(),
     263                                                       kCGImageAlphaPremultipliedLast));
     264    m_rootLayerGraphicsContext = new GraphicsContext(m_rootLayerCGContext.get());
    248265#else
    249266#error "Need to implement for your platform."
     
    305322    makeContextCurrent();
    306323
     324    checkGLError();
     325
    307326    glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId);
    308327
    309     unsigned visibleRectWidth = visibleRect.width();
    310     unsigned visibleRectHeight = visibleRect.height();
     328    checkGLError();
     329
     330    int visibleRectWidth = visibleRect.width();
     331    int visibleRectHeight = visibleRect.height();
    311332    if (visibleRectWidth != m_rootLayerTextureWidth || visibleRectHeight != m_rootLayerTextureHeight) {
    312333        m_rootLayerTextureWidth = visibleRect.width();
     
    315336        m_projectionMatrix = orthoMatrix(0, visibleRectWidth + 0.5, visibleRectHeight + 0.5, 0, -1000, 1000);
    316337        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
     338
     339        checkGLError();
    317340    }
    318341
    319342    // The GL viewport covers the entire visible area, including the scrollbars.
    320343    glViewport(0, 0, visibleRectWidth, visibleRectHeight);
     344
     345    checkGLError();
    321346
    322347    // The layer, scroll and debug border shaders all use the same vertex attributes
    323348    // so we can bind them only once.
    324349    glBindBuffer(GL_ARRAY_BUFFER, m_quadVboIds[Vertices]);
     350    checkGLError();
    325351    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadVboIds[LayerElements]);
     352    checkGLError();
    326353    GLuint offset = 0;
    327354    glVertexAttribPointer(m_positionLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
     355    checkGLError();
    328356    offset += 3 * sizeof(GLfloat);
    329357    glVertexAttribPointer(m_texCoordLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(offset));
     358    checkGLError();
    330359    glEnableVertexAttribArray(m_positionLocation);
     360    checkGLError();
    331361    glEnableVertexAttribArray(m_texCoordLocation);
     362    checkGLError();
    332363    glActiveTexture(GL_TEXTURE0);
     364    checkGLError();
    333365    glDisable(GL_DEPTH_TEST);
     366    checkGLError();
    334367    glDisable(GL_CULL_FACE);
     368    checkGLError();
    335369
    336370    if (m_scrollPosition == IntPoint(-1, -1))
     
    347381        // the contents of the updateRect.
    348382        TransformationMatrix scrolledLayerMatrix;
     383#if PLATFORM(SKIA)
     384        float scaleFactor = 1.0f;
     385#elif PLATFORM(CG)
     386        // Because the contents of the OpenGL texture are inverted
     387        // vertically compared to the Skia backend, we need to move
     388        // the backing store in the opposite direction.
     389        float scaleFactor = -1.0f;
     390#else
     391#error "Need to implement for your platform."
     392#endif
     393
    349394        scrolledLayerMatrix.translate3d((int)floorf(0.5 * visibleRect.width() + 0.5) - scrollDelta.x(),
    350             (int)floorf(0.5 * visibleRect.height() + 0.5) + scrollDelta.y(), 0);
     395            (int)floorf(0.5 * visibleRect.height() + 0.5) + scaleFactor * scrollDelta.y(), 0);
    351396        scrolledLayerMatrix.scale3d(1, -1, 1);
    352397
     
    354399        useShaderProgram(ScrollLayerProgram);
    355400        glUniform1i(m_shaderPrograms[ScrollLayerProgram].m_samplerLocation, 0);
     401        checkGLError();
    356402
    357403        drawTexturedQuad(scrolledLayerMatrix, visibleRect.width(), visibleRect.height(), 1);
     404        checkGLError();
    358405
    359406        glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height());
     
    382429        glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    383430        checkGLError();
     431#elif PLATFORM(CG)
     432        // Get the contents of the updated rect.
     433        ASSERT(static_cast<int>(CGBitmapContextGetWidth(m_rootLayerCGContext.get())) == updateRect.width() && static_cast<int>(CGBitmapContextGetHeight(m_rootLayerCGContext.get())) == updateRect.height());
     434        void* pixels = m_rootLayerBackingStore.data();
     435
     436        checkGLError();
     437        // Copy the contents of the updated rect to the root layer texture.
     438        // The origin is at the lower left in Core Graphics' coordinate system. We need to correct for this here.
     439        glTexSubImage2D(GL_TEXTURE_2D, 0,
     440                        updateRect.x(), m_rootLayerTextureHeight - updateRect.y() - updateRect.height(),
     441                        updateRect.width(), updateRect.height(),
     442                        GL_RGBA, GL_UNSIGNED_BYTE, pixels);
     443        checkGLError();
    384444#else
    385 #error Must port to your platform
     445#error "Need to implement for your platform."
    386446#endif
    387447    }
    388448
    389449    glClearColor(0, 0, 1, 1);
     450    checkGLError();
    390451    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     452    checkGLError();
    391453
    392454    // Render the root layer using a quad that takes up the entire visible area of the window.
    393455    useShaderProgram(ContentLayerProgram);
     456    checkGLError();
    394457    glUniform1i(m_samplerLocation, 0);
     458    checkGLError();
    395459    TransformationMatrix layerMatrix;
    396460    layerMatrix.translate3d(visibleRect.width() / 2, visibleRect.height() / 2, 0);
    397461    drawTexturedQuad(layerMatrix, visibleRect.width(), visibleRect.height(), 1);
     462    checkGLError();
    398463
    399464    // If culling is enabled then we will cull the backface.
    400465    glCullFace(GL_BACK);
     466    checkGLError();
    401467    // The orthographic projection is setup such that Y starts at zero and
    402468    // increases going down the page so we need to adjust the winding order of
    403469    // front facing triangles.
    404470    glFrontFace(GL_CW);
     471    checkGLError();
    405472
    406473    // The shader used to render layers returns pre-multiplied alpha colors
    407474    // so we need to send the blending mode appropriately.
    408475    glEnable(GL_BLEND);
     476    checkGLError();
    409477    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
    410478
     
    669737        "  v_texCoord = a_texCoord;   \n"
    670738        "}                            \n";
     739    // Note differences between Skia and Core Graphics versions:
     740    //  - Skia uses BGRA and origin is upper left
     741    //  - Core Graphics uses RGBA and origin is lower left
    671742    char fragmentShaderString[] =
    672743        "precision mediump float;                            \n"
     
    676747        "void main()                                         \n"
    677748        "{                                                   \n"
     749#if PLATFORM(SKIA)
    678750        "  vec4 texColor = texture2D(s_texture, v_texCoord); \n"
    679751        "  gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; \n"
     752#elif PLATFORM(CG)
     753        "  vec4 texColor = texture2D(s_texture, vec2(v_texCoord.x, 1.0 - v_texCoord.y)); \n"
     754        "  gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n"
     755#else
     756#error "Need to implement for your platform."
     757#endif
    680758        "}                                                   \n";
    681759
     
    776854    // Create a texture object to hold the contents of the root layer.
    777855    m_rootLayerTextureId = createLayerTexture();
    778     if (m_rootLayerTextureId == -1) {
     856    if (!m_rootLayerTextureId) {
    779857        LOG_ERROR("Failed to create texture for root layer");
    780858        return false;
  • trunk/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r63383 r64656  
    4242#include <wtf/PassOwnPtr.h>
    4343#include <wtf/Vector.h>
     44
     45#if PLATFORM(CG)
     46#include <CoreGraphics/CGContext.h>
     47#include <wtf/RetainPtr.h>
     48#endif
    4449
    4550namespace WebCore {
     
    146151    OwnPtr<PlatformContextSkia> m_rootLayerSkiaContext;
    147152    OwnPtr<GraphicsContext> m_rootLayerGraphicsContext;
     153#elif PLATFORM(CG)
     154    Vector<uint8_t> m_rootLayerBackingStore;
     155    RetainPtr<CGContextRef> m_rootLayerCGContext;
     156    OwnPtr<GraphicsContext> m_rootLayerGraphicsContext;
    148157#endif
     158
    149159    IntSize m_rootLayerCanvasSize;
    150160
  • trunk/WebKit/chromium/ChangeLog

    r64646 r64656  
     12010-08-02  Kenneth Russell  <kbr@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Port Chromium's accelerated compositing to Mac OS X
     6        https://bugs.webkit.org/show_bug.cgi?id=43398
     7
     8        * public/WebGLES2Context.h:
     9         - Added resizeOnscreenContent, needed on Mac OS X to report
     10           window size changes.
     11        * src/WebViewImpl.cpp:
     12        (WebKit::WebViewImpl::resize):
     13         - Send resize notification to the WebGLES2Context.
     14        (WebKit::WebViewImpl::updateRootLayerContents):
     15         - Ported to Core Graphics.
     16        (WebKit::WebViewImpl::gles2Context):
     17         - Added initial size notification upon context creation.
     18
    1192010-08-04  Pavel Feldman  <pfeldman@chromium.org>
    220
  • trunk/WebKit/chromium/public/WebGLES2Context.h

    r62942 r64656  
    5959    // Returns the ID of the texture used for offscreen rendering in the context of the parent.
    6060    virtual unsigned getOffscreenContentParentTextureId() = 0;
     61
     62    // The following function is used only on Mac OS X and is needed
     63    // in order to report window size changes.
     64#if defined(__APPLE__)
     65    virtual void resizeOnscreenContent(const WebSize&) = 0;
     66#endif
    6167};
    6268
  • trunk/WebKit/chromium/src/WebViewImpl.cpp

    r64350 r64656  
    912912        m_client->didInvalidateRect(damagedRect);
    913913    }
     914
     915#if OS(DARWIN)
     916    if (m_gles2Context) {
     917        m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
     918                                                      std::max(1, m_size.height)));
     919    }
     920#endif
    914921}
    915922
     
    21552162
    21562163        platformCanvas->restore();
     2164#elif PLATFORM(CG)
     2165        CGContextRef cgContext = rootLayerContext->platformContext();
     2166
     2167        CGContextSaveGState(cgContext);
     2168
     2169        // Bring the CoreGraphics context into the coordinate system of the paint rect.
     2170        CGContextTranslateCTM(cgContext, -rect.x, -rect.y);
     2171
     2172        rootLayerContext->save();
     2173
     2174        webframe->paintWithContext(*rootLayerContext, rect);
     2175        rootLayerContext->restore();
     2176
     2177        CGContextRestoreGState(cgContext);
     2178#else
     2179#error Must port to your platform
    21572180#endif
    21582181    }
     
    22042227            return 0;
    22052228        }
     2229
     2230#if OS(DARWIN)
     2231        m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
     2232                                                      std::max(1, m_size.height)));
     2233#endif
    22062234    }
    22072235    return m_gles2Context.get();
Note: See TracChangeset for help on using the changeset viewer.