| 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 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 | 8 |
| 9 #include "ScrollbarLayerChromium.h" | 9 #include "ScrollbarLayerChromium.h" |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "BitmapCanvasLayerTextureUpdater.h" | 12 #include "BitmapCanvasLayerTextureUpdater.h" |
| 13 #include "caching_bitmap_canvas_layer_texture_updater.h" |
| 13 #include "CCLayerTreeHost.h" | 14 #include "CCLayerTreeHost.h" |
| 14 #include "CCScrollbarLayerImpl.h" | 15 #include "CCScrollbarLayerImpl.h" |
| 15 #include "CCTextureUpdateQueue.h" | 16 #include "CCTextureUpdateQueue.h" |
| 16 #include "LayerPainterChromium.h" | 17 #include "LayerPainterChromium.h" |
| 17 #include <public/WebRect.h> | 18 #include <public/WebRect.h> |
| 18 | 19 |
| 19 using WebKit::WebRect; | 20 using WebKit::WebRect; |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 | 23 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 LayerChromium::setLayerTreeHost(host); | 189 LayerChromium::setLayerTreeHost(host); |
| 189 } | 190 } |
| 190 | 191 |
| 191 void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() | 192 void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() |
| 192 { | 193 { |
| 193 m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; | 194 m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; |
| 194 | 195 |
| 195 if (!m_backTrackUpdater) | 196 if (!m_backTrackUpdater) |
| 196 m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBa
ckgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::
WebScrollbar::BackTrackPart)); | 197 m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::create(Scro
llbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), W
ebKit::WebScrollbar::BackTrackPart)); |
| 197 if (!m_backTrack) | 198 if (!m_backTrack) |
| 198 m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->content
sTextureManager()); | 199 m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->content
sTextureManager()); |
| 199 | 200 |
| 200 // Only create two-part track if we think the two parts could be different i
n appearance. | 201 // Only create two-part track if we think the two parts could be different i
n appearance. |
| 201 if (m_scrollbar->isCustomScrollbar()) { | 202 if (m_scrollbar->isCustomScrollbar()) { |
| 202 if (!m_foreTrackUpdater) | 203 if (!m_foreTrackUpdater) |
| 203 m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(Scrollb
arBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebK
it::WebScrollbar::ForwardTrackPart)); | 204 m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::create(
ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(
), WebKit::WebScrollbar::ForwardTrackPart)); |
| 204 if (!m_foreTrack) | 205 if (!m_foreTrack) |
| 205 m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->con
tentsTextureManager()); | 206 m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->con
tentsTextureManager()); |
| 206 } | 207 } |
| 207 | 208 |
| 208 if (!m_thumbUpdater) | 209 if (!m_thumbUpdater) |
| 209 m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbP
ainter::create(m_scrollbar.get(), m_painter, m_geometry.get())); | 210 m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::create(Scrollba
rThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get())); |
| 210 if (!m_thumb) | 211 if (!m_thumb) |
| 211 m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTexture
Manager()); | 212 m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTexture
Manager()); |
| 212 } | 213 } |
| 213 | 214 |
| 214 void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextu
reUpdater::Texture* texture, const IntRect& rect, CCTextureUpdateQueue& queue, C
CRenderingStats& stats) | 215 void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextu
reUpdater::Texture* texture, const IntRect& rect, CCTextureUpdateQueue& queue, C
CRenderingStats& stats) |
| 215 { | 216 { |
| 216 // Skip painting and uploading if there are no invalidations and | 217 // Skip painting and uploading if there are no invalidations and |
| 217 // we already have valid texture data. | 218 // we already have valid texture data. |
| 218 if (texture->texture()->haveBackingTexture() | 219 if (texture->texture()->haveBackingTexture() |
| 219 && texture->texture()->size() == rect.size() | 220 && texture->texture()->size() == rect.size() |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 277 |
| 277 // Consider the thumb to be at the origin when painting. | 278 // Consider the thumb to be at the origin when painting. |
| 278 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); | 279 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); |
| 279 IntRect originThumbRect = layerRectToContentRect(WebKit::WebRect(0, 0, thumb
Rect.width, thumbRect.height)); | 280 IntRect originThumbRect = layerRectToContentRect(WebKit::WebRect(0, 0, thumb
Rect.width, thumbRect.height)); |
| 280 if (!originThumbRect.isEmpty()) | 281 if (!originThumbRect.isEmpty()) |
| 281 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); | 282 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); |
| 282 } | 283 } |
| 283 | 284 |
| 284 } | 285 } |
| 285 #endif // USE(ACCELERATED_COMPOSITING) | 286 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |