| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 CCLayerImpl::CCLayerImpl(int id) | 43 CCLayerImpl::CCLayerImpl(int id) |
| 44 : m_parent(0) | 44 : m_parent(0) |
| 45 , m_maskLayerId(-1) | 45 , m_maskLayerId(-1) |
| 46 , m_replicaLayerId(-1) | 46 , m_replicaLayerId(-1) |
| 47 , m_layerId(id) | 47 , m_layerId(id) |
| 48 , m_anchorPoint(0.5, 0.5) | 48 , m_anchorPoint(0.5, 0.5) |
| 49 , m_anchorPointZ(0) | 49 , m_anchorPointZ(0) |
| 50 , m_scrollable(false) | 50 , m_scrollable(false) |
| 51 , m_shouldScrollOnMainThread(false) | 51 , m_shouldScrollOnMainThread(false) |
| 52 , m_haveWheelEventHandlers(false) | 52 , m_haveWheelEventHandlers(false) |
| 53 , m_backgroundCoversViewport(false) | |
| 54 , m_doubleSided(true) | 53 , m_doubleSided(true) |
| 55 , m_layerPropertyChanged(false) | 54 , m_layerPropertyChanged(false) |
| 56 , m_masksToBounds(false) | 55 , m_masksToBounds(false) |
| 57 , m_opaque(false) | 56 , m_opaque(false) |
| 58 , m_opacity(1.0) | 57 , m_opacity(1.0) |
| 59 , m_preserves3D(false) | 58 , m_preserves3D(false) |
| 60 , m_usesLayerClipping(false) | 59 , m_usesLayerClipping(false) |
| 61 , m_isNonCompositedContent(false) | 60 , m_isNonCompositedContent(false) |
| 62 , m_drawsContent(false) | 61 , m_drawsContent(false) |
| 63 , m_pageScaleDelta(1) | 62 , m_pageScaleDelta(1) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 128 } |
| 130 | 129 |
| 131 PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const | 130 PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const |
| 132 { | 131 { |
| 133 IntRect layerClipRect; | 132 IntRect layerClipRect; |
| 134 if (usesLayerClipping()) | 133 if (usesLayerClipping()) |
| 135 layerClipRect = clipRect(); | 134 layerClipRect = clipRect(); |
| 136 return CCSharedQuadState::create(quadTransform(), drawTransform(), visibleLa
yerRect(), layerClipRect, drawOpacity(), opaque()); | 135 return CCSharedQuadState::create(quadTransform(), drawTransform(), visibleLa
yerRect(), layerClipRect, drawOpacity(), opaque()); |
| 137 } | 136 } |
| 138 | 137 |
| 139 void CCLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* s
haredQuadState, bool&) | |
| 140 { | |
| 141 appendGutterQuads(quadList, sharedQuadState); | |
| 142 } | |
| 143 | |
| 144 void CCLayerImpl::appendGutterQuads(CCQuadCuller& quadList, const CCSharedQuadSt
ate* sharedQuadState) | |
| 145 { | |
| 146 if (!backgroundCoversViewport() || !backgroundColor().isValid()) | |
| 147 return; | |
| 148 | |
| 149 const IntRect& layerRect = visibleLayerRect(); | |
| 150 IntRect clip = screenSpaceTransform().inverse().mapRect(clipRect()); | |
| 151 | |
| 152 if (layerRect.isEmpty()) { | |
| 153 quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, clip, back
groundColor())); | |
| 154 return; | |
| 155 } | |
| 156 | |
| 157 IntRect gutterRects[4]; | |
| 158 for (int i = 0; i < 4; i++) | |
| 159 gutterRects[i] = clip; | |
| 160 gutterRects[0].shiftMaxYEdgeTo(layerRect.y()); | |
| 161 gutterRects[1].shiftYEdgeTo(layerRect.maxY()); | |
| 162 gutterRects[2].shiftMaxXEdgeTo(layerRect.x()); | |
| 163 gutterRects[3].shiftXEdgeTo(layerRect.maxX()); | |
| 164 | |
| 165 gutterRects[2].shiftYEdgeTo(layerRect.y()); | |
| 166 gutterRects[3].shiftYEdgeTo(layerRect.y()); | |
| 167 gutterRects[2].shiftMaxYEdgeTo(layerRect.maxY()); | |
| 168 gutterRects[3].shiftMaxYEdgeTo(layerRect.maxY()); | |
| 169 | |
| 170 for (int i = 0; i < 4; i++) { | |
| 171 if (!gutterRects[i].isEmpty()) | |
| 172 quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, gutter
Rects[i], backgroundColor())); | |
| 173 } | |
| 174 } | |
| 175 | |
| 176 void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu
adState* sharedQuadState) const | 138 void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu
adState* sharedQuadState) const |
| 177 { | 139 { |
| 178 if (!hasDebugBorders()) | 140 if (!hasDebugBorders()) |
| 179 return; | 141 return; |
| 180 | 142 |
| 181 IntRect layerRect(IntPoint(), contentBounds()); | 143 IntRect layerRect(IntPoint(), contentBounds()); |
| 182 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, de
bugBorderColor(), debugBorderWidth())); | 144 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, de
bugBorderColor(), debugBorderWidth())); |
| 183 } | 145 } |
| 184 | 146 |
| 185 void CCLayerImpl::bindContentsTexture(LayerRendererChromium*) | 147 void CCLayerImpl::bindContentsTexture(LayerRendererChromium*) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 347 |
| 386 void CCLayerImpl::setBackgroundColor(const Color& backgroundColor) | 348 void CCLayerImpl::setBackgroundColor(const Color& backgroundColor) |
| 387 { | 349 { |
| 388 if (m_backgroundColor == backgroundColor) | 350 if (m_backgroundColor == backgroundColor) |
| 389 return; | 351 return; |
| 390 | 352 |
| 391 m_backgroundColor = backgroundColor; | 353 m_backgroundColor = backgroundColor; |
| 392 m_layerPropertyChanged = true; | 354 m_layerPropertyChanged = true; |
| 393 } | 355 } |
| 394 | 356 |
| 395 void CCLayerImpl::setBackgroundCoversViewport(bool backgroundCoversViewport) | |
| 396 { | |
| 397 if (m_backgroundCoversViewport == backgroundCoversViewport) | |
| 398 return; | |
| 399 | |
| 400 m_backgroundCoversViewport = backgroundCoversViewport; | |
| 401 m_layerPropertyChanged = true; | |
| 402 } | |
| 403 | |
| 404 void CCLayerImpl::setFilters(const FilterOperations& filters) | 357 void CCLayerImpl::setFilters(const FilterOperations& filters) |
| 405 { | 358 { |
| 406 if (m_filters == filters) | 359 if (m_filters == filters) |
| 407 return; | 360 return; |
| 408 | 361 |
| 409 m_filters = filters; | 362 m_filters = filters; |
| 410 noteLayerPropertyChangedForSubtree(); | 363 noteLayerPropertyChangedForSubtree(); |
| 411 } | 364 } |
| 412 | 365 |
| 413 void CCLayerImpl::setMasksToBounds(bool masksToBounds) | 366 void CCLayerImpl::setMasksToBounds(bool masksToBounds) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 498 |
| 546 void CCLayerImpl::setDoubleSided(bool doubleSided) | 499 void CCLayerImpl::setDoubleSided(bool doubleSided) |
| 547 { | 500 { |
| 548 if (m_doubleSided == doubleSided) | 501 if (m_doubleSided == doubleSided) |
| 549 return; | 502 return; |
| 550 | 503 |
| 551 m_doubleSided = doubleSided; | 504 m_doubleSided = doubleSided; |
| 552 noteLayerPropertyChangedForSubtree(); | 505 noteLayerPropertyChangedForSubtree(); |
| 553 } | 506 } |
| 554 | 507 |
| 508 Region CCLayerImpl::visibleContentOpaqueRegion() const |
| 509 { |
| 510 if (opaque()) |
| 511 return visibleLayerRect(); |
| 512 return Region(); |
| 513 } |
| 514 |
| 555 void CCLayerImpl::didLoseContext() | 515 void CCLayerImpl::didLoseContext() |
| 556 { | 516 { |
| 557 } | 517 } |
| 558 | 518 |
| 559 } | 519 } |
| 560 | 520 |
| 561 | 521 |
| 562 #endif // USE(ACCELERATED_COMPOSITING) | 522 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |