Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/canvas/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  SourceSurfaceWebgl.h

  Sprache: C
 

/* 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/. */


#ifndef MOZILLA_GFX_SOURCESURFACEWEBGL_H_
#define MOZILLA_GFX_SOURCESURFACEWEBGL_H_

#include "mozilla/WeakPtr.h"
#include "mozilla/gfx/2D.h"

namespace mozilla {
class WebGLBuffer;
}  // namespace mozilla

namespace mozilla::gfx {

class DrawTargetWebgl;
class SharedContextWebgl;
class TextureHandle;

// SourceSurfaceWebgl holds WebGL resources that can be used to efficiently
// copy snapshot data between multiple DrawTargetWebgls. It also takes care
// of copy-on-write behavior when the owner target is modified or destructs.
class SourceSurfaceWebgl : public DataSourceSurface {
 public:
  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceWebgl, override)

  explicit SourceSurfaceWebgl(DrawTargetWebgl* aDT);
  virtual ~SourceSurfaceWebgl();

  SurfaceType GetType() const override { return SurfaceType::WEBGL; }
  IntSize GetSize() const override { return mSize; }
  SurfaceFormat GetFormat() const override { return mFormat; }

  uint8_t* GetData() override;
  int32_t Stride() override;

  bool Map(MapType aType, MappedSurface* aMappedSurface) override;
  void Unmap() override;

  bool HasReadData() const { return !!mData; }

  already_AddRefed<SourceSurface> ExtractSubrect(const IntRect& aRect) override;

  bool ReadDataInto(uint8_t* aData, int32_t aStride) override;

 private:
  friend class DrawTargetWebgl;
  friend class SharedContextWebgl;

  explicit SourceSurfaceWebgl(const RefPtr<SharedContextWebgl>& aSharedContext);

  bool EnsureData(bool aForce = true, uint8_t* aData = nullptr,
                  int32_t aStride = 0);
  bool ForceReadFromPBO();

  void DrawTargetWillChange(bool aNeedHandle);

  void GiveTexture(RefPtr<TextureHandle> aHandle);

  void SetHandle(TextureHandle* aHandle);

  void OnUnlinkTexture(SharedContextWebgl* aContext, TextureHandle* aHandle,
                       bool aForce);

  DrawTargetWebgl* GetTarget() const { return mDT.get(); }

  SurfaceFormat mFormat = SurfaceFormat::UNKNOWN;
  IntSize mSize;
  RefPtr<WebGLBuffer> mReadBuffer;
  // Any data that has been read back from the WebGL context for mapping.
  RefPtr<DataSourceSurface> mData;
  // Whether the data is safe to modify
  bool mOwnsData = true;
  // The draw target that currently owns the texture for this surface.
  WeakPtr<DrawTargetWebgl> mDT;
  // The actual shared context that any WebGL resources belong to.
  WeakPtr<SharedContextWebgl> mSharedContext;
  // If this snapshot has been copied into a cached texture handle.
  RefPtr<TextureHandle> mHandle;
};

}  // namespace mozilla::gfx

#endif /* MOZILLA_GFX_SOURCESURFACEWEBGL_H_ */

Messung V0.5 in Prozent
C=87 H=100 G=93

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-08-24) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.