[go: up one dir, main page]

Attachment #548075: Part 7: Layers support for 3d transforms v2 for bug #505115

View | Details | Raw Unified | Return to bug 505115
Collapse All | Expand All

(-)a/gfx/layers/Layers.cpp (-1 / +3 lines)
Line     Link Here 
 Lines 416-432   ContainerLayer::DefaultComputeEffectiveT Link Here 
416
416
417
  PRBool useIntermediateSurface;
417
  PRBool useIntermediateSurface;
418
  float opacity = GetEffectiveOpacity();
418
  float opacity = GetEffectiveOpacity();
419
  if (opacity != 1.0f && HasMultipleChildren()) {
419
  if (opacity != 1.0f && HasMultipleChildren()) {
420
    useIntermediateSurface = PR_TRUE;
420
    useIntermediateSurface = PR_TRUE;
421
  } else {
421
  } else {
422
    useIntermediateSurface = PR_FALSE;
422
    useIntermediateSurface = PR_FALSE;
423
    gfxMatrix contTransform;
423
    gfxMatrix contTransform;
424
    if (!mEffectiveTransform.Is2D(&contTransform) ||
424
    if (!mEffectiveTransform.Is2D(&contTransform)) {
425
     useIntermediateSurface = PR_TRUE;   
426
    } else if (
425
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
427
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
426
        !contTransform.PreservesAxisAlignedRectangles()) {
428
        !contTransform.PreservesAxisAlignedRectangles()) {
427
#else
429
#else
428
        contTransform.HasNonIntegerTranslation()) {
430
        contTransform.HasNonIntegerTranslation()) {
429
#endif
431
#endif
430
      for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
432
      for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
431
        const nsIntRect *clipRect = child->GetEffectiveClipRect();
433
        const nsIntRect *clipRect = child->GetEffectiveClipRect();
432
        /* We can't (easily) forward our transform to children with a non-empty clip
434
        /* We can't (easily) forward our transform to children with a non-empty clip
(-)a/gfx/layers/d3d10/LayerManagerD3D10.cpp (-1 / +1 lines)
Line     Link Here 
 Lines 485-501   LayerManagerD3D10::SetViewport(const nsI Link Here 
485
485
486
  gfx3DMatrix projection;
486
  gfx3DMatrix projection;
487
  /*
487
  /*
488
   * Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
488
   * Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
489
   * <1.0, -1.0> bottomright)
489
   * <1.0, -1.0> bottomright)
490
   */
490
   */
491
  projection._11 = 2.0f / aViewport.width;
491
  projection._11 = 2.0f / aViewport.width;
492
  projection._22 = -2.0f / aViewport.height;
492
  projection._22 = -2.0f / aViewport.height;
493
  projection._33 = 1.0f;
493
  projection._33 = 0.0f;
494
  projection._41 = -1.0f;
494
  projection._41 = -1.0f;
495
  projection._42 = 1.0f;
495
  projection._42 = 1.0f;
496
  projection._44 = 1.0f;
496
  projection._44 = 1.0f;
497
497
498
  HRESULT hr = mEffect->GetVariableByName("mProjection")->
498
  HRESULT hr = mEffect->GetVariableByName("mProjection")->
499
    SetRawValue(&projection._11, 0, 64);
499
    SetRawValue(&projection._11, 0, 64);
500
500
501
  if (FAILED(hr)) {
501
  if (FAILED(hr)) {
(-)a/gfx/layers/d3d9/LayerManagerD3D9.cpp (+1 lines)
Line     Link Here 
 Lines 366-381   LayerManagerD3D9::SetupPipeline() Link Here 
366
366
367
  gfx3DMatrix viewMatrix;
367
  gfx3DMatrix viewMatrix;
368
  /*
368
  /*
369
   * Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
369
   * Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
370
   * <1.0, -1.0> bottomright)
370
   * <1.0, -1.0> bottomright)
371
   */
371
   */
372
  viewMatrix._11 = 2.0f / rect.width;
372
  viewMatrix._11 = 2.0f / rect.width;
373
  viewMatrix._22 = -2.0f / rect.height;
373
  viewMatrix._22 = -2.0f / rect.height;
374
  viewMatrix._33 = 0.0f;
374
  viewMatrix._41 = -1.0f;
375
  viewMatrix._41 = -1.0f;
375
  viewMatrix._42 = 1.0f;
376
  viewMatrix._42 = 1.0f;
376
377
377
  HRESULT hr = device()->SetVertexShaderConstantF(CBmProjection,
378
  HRESULT hr = device()->SetVertexShaderConstantF(CBmProjection,
378
                                                  &viewMatrix._11, 4);
379
                                                  &viewMatrix._11, 4);
379
380
380
  if (FAILED(hr)) {
381
  if (FAILED(hr)) {
381
    NS_WARNING("Failed to set projection shader constant!");
382
    NS_WARNING("Failed to set projection shader constant!");
(-)a/gfx/layers/opengl/LayerManagerOGL.cpp (-1 / +4 lines)
Line     Link Here 
 Lines 940-956   LayerManagerOGL::SetupPipeline(int aWidt Link Here 
940
  viewMatrix.Translate(-gfxPoint(1.0, -1.0));
940
  viewMatrix.Translate(-gfxPoint(1.0, -1.0));
941
  viewMatrix.Scale(2.0f / float(aWidth), 2.0f / float(aHeight));
941
  viewMatrix.Scale(2.0f / float(aWidth), 2.0f / float(aHeight));
942
  viewMatrix.Scale(1.0f, -1.0f);
942
  viewMatrix.Scale(1.0f, -1.0f);
943
943
944
  if (aTransformPolicy == ApplyWorldTransform) {
944
  if (aTransformPolicy == ApplyWorldTransform) {
945
    viewMatrix = mWorldMatrix * viewMatrix;
945
    viewMatrix = mWorldMatrix * viewMatrix;
946
  }
946
  }
947
947
948
  SetLayerProgramProjectionMatrix(gfx3DMatrix::From2D(viewMatrix));
948
  gfx3DMatrix matrix3d = gfx3DMatrix::From2D(viewMatrix);
949
  matrix3d._33 = 0.0f;
950
951
  SetLayerProgramProjectionMatrix(matrix3d);
949
}
952
}
950
953
951
void
954
void
952
LayerManagerOGL::SetupBackBuffer(int aWidth, int aHeight)
955
LayerManagerOGL::SetupBackBuffer(int aWidth, int aHeight)
953
{
956
{
954
  if (mGLContext->IsDoubleBuffered()) {
957
  if (mGLContext->IsDoubleBuffered()) {
955
    mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
958
    mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
956
    return;
959
    return;
(-)a/layout/base/nsDisplayList.cpp (+2 lines)
Line     Link Here 
 Lines 2414-2429   already_AddRefed<Layer> nsDisplayTransfo Link Here 
2414
                           aContainerParameters, &newTransformMatrix);
2414
                           aContainerParameters, &newTransformMatrix);
2415
}
2415
}
2416
2416
2417
nsDisplayItem::LayerState
2417
nsDisplayItem::LayerState
2418
nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
2418
nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
2419
                                  LayerManager* aManager) {
2419
                                  LayerManager* aManager) {
2420
  if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer))
2420
  if (mFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer))
2421
    return LAYER_ACTIVE;
2421
    return LAYER_ACTIVE;
2422
  if (!GetTransform(mFrame->PresContext()->AppUnitsPerDevPixel()).Is2D())
2423
    return LAYER_ACTIVE;
2422
  nsIFrame* activeScrolledRoot =
2424
  nsIFrame* activeScrolledRoot =
2423
    nsLayoutUtils::GetActiveScrolledRootFor(mFrame, nsnull);
2425
    nsLayoutUtils::GetActiveScrolledRootFor(mFrame, nsnull);
2424
  return !mStoredList.ChildrenCanBeInactive(aBuilder, 
2426
  return !mStoredList.ChildrenCanBeInactive(aBuilder, 
2425
                                             aManager, 
2427
                                             aManager, 
2426
                                             *mStoredList.GetList(), 
2428
                                             *mStoredList.GetList(), 
2427
                                             activeScrolledRoot)
2429
                                             activeScrolledRoot)
2428
      ? LAYER_ACTIVE : LAYER_INACTIVE;
2430
      ? LAYER_ACTIVE : LAYER_INACTIVE;
2429
}
2431
}

Return to bug 505115