| 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 "CCScrollbarLayerImpl.h" | 9 #include "CCScrollbarLayerImpl.h" |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); | 85 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); |
| 86 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 86 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
| 87 | 87 |
| 88 WebRect thumbRect, backTrackRect, foreTrackRect; | 88 WebRect thumbRect, backTrackRect, foreTrackRect; |
| 89 m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), ba
ckTrackRect, thumbRect, foreTrackRect); | 89 m_geometry->splitTrack(&m_scrollbar, m_geometry->trackRect(&m_scrollbar), ba
ckTrackRect, thumbRect, foreTrackRect); |
| 90 if (!m_geometry->hasThumb(&m_scrollbar)) | 90 if (!m_geometry->hasThumb(&m_scrollbar)) |
| 91 thumbRect = WebRect(); | 91 thumbRect = WebRect(); |
| 92 | 92 |
| 93 if (m_thumbResourceId && !thumbRect.isEmpty()) { | 93 if (m_thumbResourceId && !thumbRect.isEmpty()) { |
| 94 OwnPtr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQuadSta
te, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha, uvR
ect, flipped); | 94 scoped_ptr<CCTextureDrawQuad> quad = CCTextureDrawQuad::create(sharedQua
dState, layerRectToContentRect(thumbRect), m_thumbResourceId, premultipledAlpha,
uvRect, flipped); |
| 95 quad->setNeedsBlending(); | 95 quad->setNeedsBlending(); |
| 96 quadSink.append(quad.release(), appendQuadsData); | 96 quadSink.append(quad.PassAs<CCDrawQuad>(), appendQuadsData); |
| 97 } | 97 } |
| 98 | 98 |
| 99 if (!m_backTrackResourceId) | 99 if (!m_backTrackResourceId) |
| 100 return; | 100 return; |
| 101 | 101 |
| 102 // We only paint the track in two parts if we were given a texture for the f
orward track part. | 102 // We only paint the track in two parts if we were given a texture for the f
orward track part. |
| 103 if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) | 103 if (m_foreTrackResourceId && !foreTrackRect.isEmpty()) |
| 104 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, layerRectToCo
ntentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(for
eTrackRect, boundsRect), flipped), appendQuadsData); | 104 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, layerRectToCo
ntentRect(foreTrackRect), m_foreTrackResourceId, premultipledAlpha, toUVRect(for
eTrackRect, boundsRect), flipped).PassAs<CCDrawQuad>(), appendQuadsData); |
| 105 | 105 |
| 106 // Order matters here: since the back track texture is being drawn to the en
tire contents rect, we must append it after the thumb and | 106 // Order matters here: since the back track texture is being drawn to the en
tire contents rect, we must append it after the thumb and |
| 107 // fore track quads. The back track texture contains (and displays) the butt
ons. | 107 // fore track quads. The back track texture contains (and displays) the butt
ons. |
| 108 if (!contentBoundsRect.isEmpty()) | 108 if (!contentBoundsRect.isEmpty()) |
| 109 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(conte
ntBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped), appen
dQuadsData); | 109 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, IntRect(conte
ntBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs
<CCDrawQuad>(), appendQuadsData); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void CCScrollbarLayerImpl::didLoseContext() | 112 void CCScrollbarLayerImpl::didLoseContext() |
| 113 { | 113 { |
| 114 m_backTrackResourceId = 0; | 114 m_backTrackResourceId = 0; |
| 115 m_foreTrackResourceId = 0; | 115 m_foreTrackResourceId = 0; |
| 116 m_thumbResourceId = 0; | 116 m_thumbResourceId = 0; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool CCScrollbarLayerImpl::CCScrollbar::isOverlay() const | 119 bool CCScrollbarLayerImpl::CCScrollbar::isOverlay() const |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 const char* CCScrollbarLayerImpl::layerTypeAsString() const | 199 const char* CCScrollbarLayerImpl::layerTypeAsString() const |
| 200 { | 200 { |
| 201 return "ScrollbarLayer"; | 201 return "ScrollbarLayer"; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } | 204 } |
| 205 | 205 |
| 206 #endif // USE(ACCELERATED_COMPOSITING) | 206 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |