| 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 "cc/test/tiled_layer_test_common.h" | 7 #include "cc/test/tiled_layer_test_common.h" |
| 8 | 8 |
| 9 using namespace cc; | 9 using namespace cc; |
| 10 | 10 |
| 11 namespace WebKitTests { | 11 namespace WebKitTests { |
| 12 | 12 |
| 13 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedTexture> texture) | 13 FakeLayerUpdater::Resource::Resource(FakeLayerUpdater* layer, scoped_ptr<Priorit
izedResource> texture) |
| 14 : LayerUpdater::Resource(texture.Pass()) | 14 : LayerUpdater::Resource(texture.Pass()) |
| 15 , m_layer(layer) | 15 , m_layer(layer) |
| 16 { | 16 { |
| 17 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 17 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
| 18 m_bitmap.allocPixels(); | 18 m_bitmap.allocPixels(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 FakeLayerUpdater::Resource::~Resource() | 21 FakeLayerUpdater::Resource::~Resource() |
| 22 { | 22 { |
| 23 } | 23 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 resultingOpaqueRect = m_opaquePaintRect; | 57 resultingOpaqueRect = m_opaquePaintRect; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer
* layer) | 60 void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer
* layer) |
| 61 { | 61 { |
| 62 m_rectToInvalidate = rect; | 62 m_rectToInvalidate = rect; |
| 63 m_layer = layer; | 63 m_layer = layer; |
| 64 } | 64 } |
| 65 | 65 |
| 66 scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedT
extureManager* manager) | 66 scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedR
esourceManager* manager) |
| 67 { | 67 { |
| 68 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedText
ure::create(manager))); | 68 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedReso
urce::create(manager))); |
| 69 } | 69 } |
| 70 | 70 |
| 71 FakeTiledLayerImpl::FakeTiledLayerImpl(int id) | 71 FakeTiledLayerImpl::FakeTiledLayerImpl(int id) |
| 72 : TiledLayerImpl(id) | 72 : TiledLayerImpl(id) |
| 73 { | 73 { |
| 74 } | 74 } |
| 75 | 75 |
| 76 FakeTiledLayerImpl::~FakeTiledLayerImpl() | 76 FakeTiledLayerImpl::~FakeTiledLayerImpl() |
| 77 { | 77 { |
| 78 } | 78 } |
| 79 | 79 |
| 80 FakeTiledLayer::FakeTiledLayer(PrioritizedTextureManager* textureManager) | 80 FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resourceManager) |
| 81 : TiledLayer() | 81 : TiledLayer() |
| 82 , m_fakeUpdater(make_scoped_refptr(new FakeLayerUpdater)) | 82 , m_fakeUpdater(make_scoped_refptr(new FakeLayerUpdater)) |
| 83 , m_textureManager(textureManager) | 83 , m_resourceManager(resourceManager) |
| 84 { | 84 { |
| 85 setTileSize(tileSize()); | 85 setTileSize(tileSize()); |
| 86 setTextureFormat(GL_RGBA); | 86 setTextureFormat(GL_RGBA); |
| 87 setBorderTexelOption(LayerTilingData::NoBorderTexels); | 87 setBorderTexelOption(LayerTilingData::NoBorderTexels); |
| 88 setIsDrawable(true); // So that we don't get false positives if any of these
tests expect to return false from drawsContent() for other reasons. | 88 setIsDrawable(true); // So that we don't get false positives if any of these
tests expect to return false from drawsContent() for other reasons. |
| 89 } | 89 } |
| 90 | 90 |
| 91 FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedTextur
eManager* textureManager) | 91 FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds(PrioritizedResour
ceManager* resourceManager) |
| 92 : FakeTiledLayer(textureManager) | 92 : FakeTiledLayer(resourceManager) |
| 93 { | 93 { |
| 94 } | 94 } |
| 95 | 95 |
| 96 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() | 96 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 | 99 |
| 100 FakeTiledLayer::~FakeTiledLayer() | 100 FakeTiledLayer::~FakeTiledLayer() |
| 101 { | 101 { |
| 102 } | 102 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 117 createRenderSurface(); | 117 createRenderSurface(); |
| 118 | 118 |
| 119 TiledLayer::setTexturePriorities(calculator); | 119 TiledLayer::setTexturePriorities(calculator); |
| 120 | 120 |
| 121 if (missingTargetRenderSurface) { | 121 if (missingTargetRenderSurface) { |
| 122 clearRenderSurface(); | 122 clearRenderSurface(); |
| 123 setRenderTarget(0); | 123 setRenderTarget(0); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 cc::PrioritizedTextureManager* FakeTiledLayer::textureManager() const | 127 cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const |
| 128 { | 128 { |
| 129 return m_textureManager; | 129 return m_resourceManager; |
| 130 } | 130 } |
| 131 | 131 |
| 132 cc::LayerUpdater* FakeTiledLayer::updater() const | 132 cc::LayerUpdater* FakeTiledLayer::updater() const |
| 133 { | 133 { |
| 134 return m_fakeUpdater.get(); | 134 return m_fakeUpdater.get(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const | 137 gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const |
| 138 { | 138 { |
| 139 return m_forcedContentBounds; | 139 return m_forcedContentBounds; |
| 140 } | 140 } |
| 141 | 141 |
| 142 float FakeTiledLayerWithScaledBounds::contentsScaleX() const | 142 float FakeTiledLayerWithScaledBounds::contentsScaleX() const |
| 143 { | 143 { |
| 144 return static_cast<float>(m_forcedContentBounds.width()) / bounds().width(); | 144 return static_cast<float>(m_forcedContentBounds.width()) / bounds().width(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 float FakeTiledLayerWithScaledBounds::contentsScaleY() const | 147 float FakeTiledLayerWithScaledBounds::contentsScaleY() const |
| 148 { | 148 { |
| 149 return static_cast<float>(m_forcedContentBounds.height()) / bounds().height(
); | 149 return static_cast<float>(m_forcedContentBounds.height()) / bounds().height(
); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void FakeTiledLayerWithScaledBounds::setContentsScale(float) | 152 void FakeTiledLayerWithScaledBounds::setContentsScale(float) |
| 153 { | 153 { |
| 154 NOTREACHED(); | 154 NOTREACHED(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| OLD | NEW |