mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-12 14:37:50 +00:00
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "BasicCanvasLayer.h"
|
|
#include "basic/BasicLayers.h" // for BasicLayerManager
|
|
#include "mozilla/mozalloc.h" // for operator new
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
|
|
class gfxContext;
|
|
|
|
using namespace mozilla::gfx;
|
|
using namespace mozilla::gl;
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
void
|
|
BasicCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
|
|
{
|
|
if (IsHidden())
|
|
return;
|
|
|
|
FirePreTransactionCallback();
|
|
UpdateSurface();
|
|
FireDidTransactionCallback();
|
|
|
|
gfxContext::GraphicsOperator mixBlendMode = GetEffectiveMixBlendMode();
|
|
PaintWithOpacity(aContext, GetEffectiveOpacity(), aMaskLayer, mixBlendMode != gfxContext::OPERATOR_OVER ? mixBlendMode : GetOperator());
|
|
}
|
|
|
|
already_AddRefed<CanvasLayer>
|
|
BasicLayerManager::CreateCanvasLayer()
|
|
{
|
|
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
|
|
nsRefPtr<CanvasLayer> layer = new BasicCanvasLayer(this);
|
|
return layer.forget();
|
|
}
|
|
|
|
}
|
|
}
|