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