| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "ImageLayerChromium.h" | 7 #include "ImageLayerChromium.h" |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "CCLayerTreeHost.h" | 10 #include "CCLayerTreeHost.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 { | 28 { |
| 29 textureUpdater()->updateTexture(queue, texture(), sourceRect, destOf
fset, partialUpdate); | 29 textureUpdater()->updateTexture(queue, texture(), sourceRect, destOf
fset, partialUpdate); |
| 30 } | 30 } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 ImageLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } | 33 ImageLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } |
| 34 | 34 |
| 35 ImageLayerTextureUpdater* m_textureUpdater; | 35 ImageLayerTextureUpdater* m_textureUpdater; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 static PassRefPtr<ImageLayerTextureUpdater> create() | 38 static scoped_refptr<ImageLayerTextureUpdater> create() |
| 39 { | 39 { |
| 40 return adoptRef(new ImageLayerTextureUpdater()); | 40 return make_scoped_refptr(new ImageLayerTextureUpdater()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual ~ImageLayerTextureUpdater() { } | 43 virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture( |
| 44 | |
| 45 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture( | |
| 46 CCPrioritizedTextureManager* manager) OVERRIDE | 44 CCPrioritizedTextureManager* manager) OVERRIDE |
| 47 { | 45 { |
| 48 return adoptPtr(new Texture(this, CCPrioritizedTexture::create(manager))
); | 46 return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrio
ritizedTexture::create(manager))); |
| 49 } | 47 } |
| 50 | 48 |
| 51 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE | 49 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE |
| 52 { | 50 { |
| 53 return PlatformColor::sameComponentOrder(textureFormat) ? | 51 return PlatformColor::sameComponentOrder(textureFormat) ? |
| 54 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate
r::SampledTexelFormatBGRA; | 52 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate
r::SampledTexelFormatBGRA; |
| 55 } | 53 } |
| 56 | 54 |
| 57 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) | 55 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur
e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) |
| 58 { | 56 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 queue.appendFullUpload(upload); | 69 queue.appendFullUpload(upload); |
| 72 } | 70 } |
| 73 | 71 |
| 74 void setBitmap(const SkBitmap& bitmap) | 72 void setBitmap(const SkBitmap& bitmap) |
| 75 { | 73 { |
| 76 m_bitmap = bitmap; | 74 m_bitmap = bitmap; |
| 77 } | 75 } |
| 78 | 76 |
| 79 private: | 77 private: |
| 80 ImageLayerTextureUpdater() { } | 78 ImageLayerTextureUpdater() { } |
| 79 virtual ~ImageLayerTextureUpdater() { } |
| 81 | 80 |
| 82 SkBitmap m_bitmap; | 81 SkBitmap m_bitmap; |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 scoped_refptr<ImageLayerChromium> ImageLayerChromium::create() | 84 scoped_refptr<ImageLayerChromium> ImageLayerChromium::create() |
| 86 { | 85 { |
| 87 return make_scoped_refptr(new ImageLayerChromium()); | 86 return make_scoped_refptr(new ImageLayerChromium()); |
| 88 } | 87 } |
| 89 | 88 |
| 90 ImageLayerChromium::ImageLayerChromium() | 89 ImageLayerChromium::ImageLayerChromium() |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return !m_bitmap.isNull() && TiledLayerChromium::drawsContent(); | 154 return !m_bitmap.isNull() && TiledLayerChromium::drawsContent(); |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool ImageLayerChromium::needsContentsScale() const | 157 bool ImageLayerChromium::needsContentsScale() const |
| 159 { | 158 { |
| 160 // Contents scale is not need for image layer because this can be done in co
mpositor more efficiently. | 159 // Contents scale is not need for image layer because this can be done in co
mpositor more efficiently. |
| 161 return false; | 160 return false; |
| 162 } | 161 } |
| 163 | 162 |
| 164 } | 163 } |
| OLD | NEW |