| OLD | NEW |
| (Empty) |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 | |
| 7 #if USE(ACCELERATED_COMPOSITING) | |
| 8 | |
| 9 #include "CCSolidColorLayerImpl.h" | |
| 10 | |
| 11 #include "CCQuadSink.h" | |
| 12 #include "CCSolidColorDrawQuad.h" | |
| 13 #include <wtf/MathExtras.h> | |
| 14 | |
| 15 using namespace std; | |
| 16 using WebKit::WebTransformationMatrix; | |
| 17 | |
| 18 namespace cc { | |
| 19 | |
| 20 CCSolidColorLayerImpl::CCSolidColorLayerImpl(int id) | |
| 21 : CCLayerImpl(id) | |
| 22 , m_tileSize(256) | |
| 23 { | |
| 24 } | |
| 25 | |
| 26 CCSolidColorLayerImpl::~CCSolidColorLayerImpl() | |
| 27 { | |
| 28 } | |
| 29 | |
| 30 void CCSolidColorLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData&
appendQuadsData) | |
| 31 { | |
| 32 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); | |
| 33 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | |
| 34 | |
| 35 // We create a series of smaller quads instead of just one large one so that
the | |
| 36 // culler can reduce the total pixels drawn. | |
| 37 int width = contentBounds().width(); | |
| 38 int height = contentBounds().height(); | |
| 39 for (int x = 0; x < width; x += m_tileSize) { | |
| 40 for (int y = 0; y < height; y += m_tileSize) { | |
| 41 IntRect solidTileRect(x, y, min(width - x, m_tileSize), min(height -
y, m_tileSize)); | |
| 42 quadSink.append(CCSolidColorDrawQuad::create(sharedQuadState, solidT
ileRect, backgroundColor()).PassAs<CCDrawQuad>(), appendQuadsData); | |
| 43 } | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 const char* CCSolidColorLayerImpl::layerTypeAsString() const | |
| 48 { | |
| 49 return "SolidColorLayer"; | |
| 50 } | |
| 51 | |
| 52 } // namespace cc | |
| 53 #endif // USE(ACCELERATED_COMPOSITING) | |
| OLD | NEW |