| 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/scrollbar_layer.h" | 7 #include "cc/scrollbar_layer.h" |
| 8 | 8 |
| 9 #include "CCLayerTreeHost.h" | 9 #include "CCLayerTreeHost.h" |
| 10 #include "CCScrollbarLayerImpl.h" | 10 #include "CCScrollbarLayerImpl.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater*
painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUp
dateQueue& queue, CCRenderingStats& stats) | 212 void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater*
painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUp
dateQueue& queue, CCRenderingStats& stats) |
| 213 { | 213 { |
| 214 // Skip painting and uploading if there are no invalidations and | 214 // Skip painting and uploading if there are no invalidations and |
| 215 // we already have valid texture data. | 215 // we already have valid texture data. |
| 216 if (texture->texture()->haveBackingTexture() | 216 if (texture->texture()->haveBackingTexture() |
| 217 && texture->texture()->size() == rect.size() | 217 && texture->texture()->size() == rect.size() |
| 218 && m_updateRect.isEmpty()) | 218 && m_updateRect.isEmpty()) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 // We should always have enough memory for UI. | 221 // We should always have enough memory for UI. |
| 222 ASSERT(texture->texture()->canAcquireBackingTexture()); | 222 DCHECK(texture->texture()->canAcquireBackingTexture()); |
| 223 if (!texture->texture()->canAcquireBackingTexture()) | 223 if (!texture->texture()->canAcquireBackingTexture()) |
| 224 return; | 224 return; |
| 225 | 225 |
| 226 // Paint and upload the entire part. | 226 // Paint and upload the entire part. |
| 227 float widthScale = static_cast<float>(contentBounds().width()) / bounds().wi
dth(); | 227 float widthScale = static_cast<float>(contentBounds().width()) / bounds().wi
dth(); |
| 228 float heightScale = static_cast<float>(contentBounds().height()) / bounds().
height(); | 228 float heightScale = static_cast<float>(contentBounds().height()) / bounds().
height(); |
| 229 IntRect paintedOpaqueRect; | 229 IntRect paintedOpaqueRect; |
| 230 painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, painted
OpaqueRect, stats); | 230 painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, painted
OpaqueRect, stats); |
| 231 if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture())
{ | 231 if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture())
{ |
| 232 TRACE_EVENT_INSTANT0("cc","ScrollbarLayerChromium::updatePart no texture
upload needed"); | 232 TRACE_EVENT_INSTANT0("cc","ScrollbarLayerChromium::updatePart no texture
upload needed"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); | 275 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); |
| 276 | 276 |
| 277 // Consider the thumb to be at the origin when painting. | 277 // Consider the thumb to be at the origin when painting. |
| 278 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); | 278 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); |
| 279 IntRect originThumbRect = layerRectToContentRect(WebKit::WebRect(0, 0, thumb
Rect.width, thumbRect.height)); | 279 IntRect originThumbRect = layerRectToContentRect(WebKit::WebRect(0, 0, thumb
Rect.width, thumbRect.height)); |
| 280 if (!originThumbRect.isEmpty()) | 280 if (!originThumbRect.isEmpty()) |
| 281 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); | 281 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } | 284 } |
| OLD | NEW |