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