Skip to content
Permalink
Browse files
[chromium] Add WebSolidColorLayer interface to draw non-textured colo…
…r layers from Aura.

https://bugs.webkit.org/show_bug.cgi?id=75732

Reviewed by James Robinson.

Source/WebCore:

Add WebSolidColorLayer to paint solid-color layers without a backing texture.

Test: unit test for CCSolidColorLayerImpl.

* WebCore.gypi:
* platform/graphics/chromium/SolidColorLayerChromium.cpp: Added.
(WebCore::SolidColorLayerChromium::createCCLayerImpl):
(WebCore::SolidColorLayerChromium::create):
(WebCore::SolidColorLayerChromium::SolidColorLayerChromium):
(WebCore::SolidColorLayerChromium::~SolidColorLayerChromium):
* platform/graphics/chromium/SolidColorLayerChromium.h: Added.
* platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: Added.
(WebCore::CCSolidColorLayerImpl::CCSolidColorLayerImpl):
(WebCore::CCSolidColorLayerImpl::~CCSolidColorLayerImpl):
(WebCore::CCSolidColorLayerImpl::quadTransform):
(WebCore::CCSolidColorLayerImpl::appendQuads):
* platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: Added.
(WebCore::CCSolidColorLayerImpl::create):
(WebCore::CCSolidColorLayerImpl::layerTypeAsString):

Source/WebKit/chromium:

* WebKit.gyp:
* WebKit.gypi:
* public/platform/WebSolidColorLayer.h: Added.
* src/WebSolidColorLayer.cpp: Added.
(WebKit::WebSolidColorLayer::create):
(WebKit::WebSolidColorLayer::WebSolidColorLayer):
(WebKit::WebSolidColorLayer::setBackgroundColor):
* src/WebSolidColorLayerImpl.cpp: Added.
(WebKit::WebSolidColorLayerImpl::create):
(WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
(WebKit::WebSolidColorLayerImpl::~WebSolidColorLayerImpl):
* src/WebSolidColorLayerImpl.h: Added.
* tests/CCLayerTestCommon.cpp: Added.
(CCLayerTestCommon::completelyContains):
(CCLayerTestCommon::verifyQuadsExactlyCoverRect):
* tests/CCLayerTestCommon.h: Added.
* tests/CCSolidColorLayerImplTest.cpp: Added.
(CCLayerTestCommon::TEST):
* tests/CCTiledLayerImplTest.cpp:

Canonical link: https://commits.webkit.org/93668@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
W. James MacLean committed Jan 23, 2012
1 parent c74c039 commit 61af71e6aa23222da85669171285b398f941f763
Showing 17 changed files with 685 additions and 28 deletions.
@@ -1,3 +1,30 @@
2012-01-23 W. James MacLean <wjmaclean@chromium.org>

[chromium] Add WebSolidColorLayer interface to draw non-textured color layers from Aura.
https://bugs.webkit.org/show_bug.cgi?id=75732

Reviewed by James Robinson.

Add WebSolidColorLayer to paint solid-color layers without a backing texture.

Test: unit test for CCSolidColorLayerImpl.

* WebCore.gypi:
* platform/graphics/chromium/SolidColorLayerChromium.cpp: Added.
(WebCore::SolidColorLayerChromium::createCCLayerImpl):
(WebCore::SolidColorLayerChromium::create):
(WebCore::SolidColorLayerChromium::SolidColorLayerChromium):
(WebCore::SolidColorLayerChromium::~SolidColorLayerChromium):
* platform/graphics/chromium/SolidColorLayerChromium.h: Added.
* platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp: Added.
(WebCore::CCSolidColorLayerImpl::CCSolidColorLayerImpl):
(WebCore::CCSolidColorLayerImpl::~CCSolidColorLayerImpl):
(WebCore::CCSolidColorLayerImpl::quadTransform):
(WebCore::CCSolidColorLayerImpl::appendQuads):
* platform/graphics/chromium/cc/CCSolidColorLayerImpl.h: Added.
(WebCore::CCSolidColorLayerImpl::create):
(WebCore::CCSolidColorLayerImpl::layerTypeAsString):

2012-01-23 Antti Koivisto <antti@apple.com>

Attempt to fix Qt build.
@@ -3573,6 +3573,8 @@
'platform/graphics/chromium/LayerTextureSubImage.h',
'platform/graphics/chromium/LayerTextureUpdater.h',
'platform/graphics/chromium/MediaPlayerPrivateChromium.h',
'platform/graphics/chromium/SolidColorLayerChromium.cpp',
'platform/graphics/chromium/SolidColorLayerChromium.h',
'platform/graphics/chromium/PlatformCanvas.cpp',
'platform/graphics/chromium/PlatformCanvas.h',
'platform/graphics/chromium/PlatformColor.h',
@@ -3682,6 +3684,8 @@
'platform/graphics/chromium/cc/CCSingleThreadProxy.h',
'platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp',
'platform/graphics/chromium/cc/CCSolidColorDrawQuad.h',
'platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp',
'platform/graphics/chromium/cc/CCSolidColorLayerImpl.h',
'platform/graphics/chromium/cc/CCTextureUpdater.cpp',
'platform/graphics/chromium/cc/CCTextureUpdater.h',
'platform/graphics/chromium/cc/CCTileDrawQuad.cpp',
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

#if USE(ACCELERATED_COMPOSITING)

#include "SolidColorLayerChromium.h"

#include "cc/CCSolidColorLayerImpl.h"

namespace WebCore {

PassRefPtr<CCLayerImpl> SolidColorLayerChromium::createCCLayerImpl()
{
return CCSolidColorLayerImpl::create(id());
}

PassRefPtr<SolidColorLayerChromium> SolidColorLayerChromium::create()
{
return adoptRef(new SolidColorLayerChromium());
}

SolidColorLayerChromium::SolidColorLayerChromium()
: LayerChromium()
{
}

SolidColorLayerChromium::~SolidColorLayerChromium()
{
}

} // namespace WebCore

#endif // USE(ACCELERATED_COMPOSITING)
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


#ifndef SolidColorLayerChromium_h
#define SolidColorLayerChromium_h

#if USE(ACCELERATED_COMPOSITING)

#include "LayerChromium.h"

namespace WebCore {

class LayerTilerChromium;

// A Layer that renders a solid color. The color is specified by using
// setBackgroundColor() on the base class.
class SolidColorLayerChromium : public LayerChromium {
public:
virtual PassRefPtr<CCLayerImpl> createCCLayerImpl();
static PassRefPtr<SolidColorLayerChromium> create();

virtual ~SolidColorLayerChromium();

protected:
SolidColorLayerChromium();
};

}
#endif // USE(ACCELERATED_COMPOSITING)

#endif

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

#if USE(ACCELERATED_COMPOSITING)

#include "cc/CCSolidColorLayerImpl.h"

#include "LayerRendererChromium.h"
#include "cc/CCSolidColorDrawQuad.h"
#include <wtf/MathExtras.h>
#include <wtf/text/WTFString.h>

using namespace std;

namespace WebCore {

CCSolidColorLayerImpl::CCSolidColorLayerImpl(int id)
: CCLayerImpl(id)
, m_tileSize(256)
{
}

CCSolidColorLayerImpl::~CCSolidColorLayerImpl()
{
}

TransformationMatrix CCSolidColorLayerImpl::quadTransform() const
{
TransformationMatrix solidColorTransform = drawTransform();
solidColorTransform.translate(-bounds().width() / 2.0, -bounds().height() / 2.0);

return solidColorTransform;
}

void CCSolidColorLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState)
{
// We create a series of smaller quads instead of just one large one so that the
// culler can reduce the total pixels drawn.
int width = bounds().width();
int height = bounds().height();
for (int x = 0; x < width; x += m_tileSize) {
for (int y = 0; y < height; y += m_tileSize) {
IntRect solidTileRect(x, y, min(width - x, m_tileSize), min(height - y, m_tileSize));
quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, solidTileRect, backgroundColor()));
}
}
}

} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef CCSolidColorLayerImpl_h
#define CCSolidColorLayerImpl_h

#include "TransformationMatrix.h"
#include "cc/CCLayerImpl.h"

namespace WebCore {

class LayerRendererChromium;

class CCSolidColorLayerImpl : public CCLayerImpl {
public:
static PassRefPtr<CCSolidColorLayerImpl> create(int id)
{
return adoptRef(new CCSolidColorLayerImpl(id));
}
virtual ~CCSolidColorLayerImpl();

virtual TransformationMatrix quadTransform() const;
virtual void appendQuads(CCQuadList&, const CCSharedQuadState*);

protected:
explicit CCSolidColorLayerImpl(int id);

private:
virtual const char* layerTypeAsString() const { return "SolidColorLayer"; }

const int m_tileSize;
};

}

#endif // CCSolidColorLayerImpl_h
@@ -1,3 +1,30 @@
2012-01-23 W. James MacLean <wjmaclean@chromium.org>

[chromium] Add WebSolidColorLayer interface to draw non-textured color layers from Aura.
https://bugs.webkit.org/show_bug.cgi?id=75732

Reviewed by James Robinson.

* WebKit.gyp:
* WebKit.gypi:
* public/platform/WebSolidColorLayer.h: Added.
* src/WebSolidColorLayer.cpp: Added.
(WebKit::WebSolidColorLayer::create):
(WebKit::WebSolidColorLayer::WebSolidColorLayer):
(WebKit::WebSolidColorLayer::setBackgroundColor):
* src/WebSolidColorLayerImpl.cpp: Added.
(WebKit::WebSolidColorLayerImpl::create):
(WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
(WebKit::WebSolidColorLayerImpl::~WebSolidColorLayerImpl):
* src/WebSolidColorLayerImpl.h: Added.
* tests/CCLayerTestCommon.cpp: Added.
(CCLayerTestCommon::completelyContains):
(CCLayerTestCommon::verifyQuadsExactlyCoverRect):
* tests/CCLayerTestCommon.h: Added.
* tests/CCSolidColorLayerImplTest.cpp: Added.
(CCLayerTestCommon::TEST):
* tests/CCTiledLayerImplTest.cpp:

2012-01-20 Pavel Feldman <pfeldman@google.com>

Web Inspector: PageAgent.open() dosen't belong to the protocol.
@@ -326,6 +326,7 @@
'public/platform/WebSocketStreamError.h',
'public/platform/WebSocketStreamHandle.h',
'public/platform/WebSocketStreamHandleClient.h',
'public/platform/WebSolidColorLayer.h',
'public/platform/WebString.h',
'public/platform/WebThread.h',
'public/platform/WebThreadSafeData.h',
@@ -638,6 +639,8 @@
'src/WebSocket.cpp',
'src/WebSocketImpl.cpp',
'src/WebSocketImpl.h',
'src/WebSolidColorLayer.cpp',
'src/WebSolidColorLayerImpl.cpp',
'src/WebSpeechInputControllerMockImpl.cpp',
'src/WebSpeechInputControllerMockImpl.h',
'src/WebSpeechInputResult.cpp',
@@ -69,6 +69,8 @@
'tests/CCLayerIteratorTest.cpp',
'tests/CCLayerQuadTest.cpp',
'tests/CCLayerSorterTest.cpp',
'tests/CCLayerTestCommon.cpp',
'tests/CCLayerTestCommon.h',
'tests/CCLayerTreeHostCommonTest.cpp',
'tests/CCLayerTreeHostImplTest.cpp',
'tests/CCLayerTreeHostTest.cpp',
@@ -78,6 +80,7 @@
'tests/CCSchedulerStateMachineTest.cpp',
'tests/CCSchedulerTestCommon.h',
'tests/CCSchedulerTest.cpp',
'tests/CCSolidColorLayerImplTest.cpp',
'tests/CCTiledLayerImplTest.cpp',
'tests/CCThreadTaskTest.cpp',
'tests/CCTimerTest.cpp',

0 comments on commit 61af71e

Please sign in to comment.