protected override void InternalDrawGraphics(int x, int y, IRSGraphicsProvider <Graphics> rsGraphicsProvider, bool force = false) { lock (rsGraphicsProvider.SyncObj) { rsGraphicsProvider.GameGraphics.DrawImageUnscaled(image, x, y); } }
/// <summary> /// Publicly exposed graphics drawing method found in the original Java client. /// </summary> /// <param name="y"></param> /// <param name="g"></param> /// <param name="x"></param> public void drawGraphics(int y, IRSGraphicsProvider <TGraphicsType> g, int x, bool force = false) { OnBeforeInternalDrawGraphics(y, x); lock (g.SyncObj) { InternalDrawGraphics(x, y, g, force); } }
protected override void OnBeforeInternalDrawGraphics(int x, int z, IRSGraphicsProvider <UnityRsGraphics> graphicsObject) { //Texture creation is async if (!Image.IsCompleted) { return; } method239(); }
protected override void InternalDrawGraphics(int x, int y, IRSGraphicsProvider <UnityRsGraphics> rsGraphicsProvider, bool force = false) { //Might not be created yet, not promised to be created. if (!Image.IsCompleted) { return; } lock (rsGraphicsProvider.SyncObj) { rsGraphicsProvider.GameGraphics.DrawImageToScreen(this.Name, x, y); } }
public UnityRsImageProducer(int width, int height, string name, IRSGraphicsProvider <UnityRsGraphics> graphicsProvider) : base(width, height, name) { try { lock (graphicsProvider.SyncObj) { Image = graphicsProvider.GameGraphics.CreateTexture(new TextureCreationRequest(width, height, name)); TempBufferPixels = new int[width * height]; } } catch (Exception e) { throw new InvalidOperationException($"Failed to create ImageProducer for: {name}", e); throw; } initDrawingArea(); }
protected override void InternalDrawGraphics(int x, int y, IRSGraphicsProvider <OpenTKRsGraphicsContext> rsGraphicsProvider, bool force = false) { ImageLocation = new Rectangle(x, y, width, height); //It's only dirty if they accessed the pixel buffer. //TODO: We can optimize around this in the client itself. lock (SyncObject) { if (accessedPixelBuffer) { //There is a race condition here. But it's for significant performance benefit. accessedPixelBuffer = false; isDirty = true; } else if (force) { isDirty = true; } } }
/// <summary> /// Called when the graphics drawing is requested. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="graphicsObject"></param> protected abstract void InternalDrawGraphics(int x, int y, IRSGraphicsProvider <TGraphicsType> graphicsObject, bool force = false);
/// <summary> /// Called BEFORE the graphics drawing is requested. /// Do setup/initialization work here because the lock on the graphics object isn't aquiried here yet. /// </summary> /// <param name="x"></param> /// <param name="z"></param> /// <param name="graphicsObject"></param> protected abstract void OnBeforeInternalDrawGraphics(int x, int z, IRSGraphicsProvider <TGraphicsType> graphicsObject);
/*public override int[] pixels * { * get * { * //There is a race condition here. But it's for significant performance benefit. * accessedPixelBuffer = true; * return base.pixels; * } * }*/ protected override void OnBeforeInternalDrawGraphics(int x, int z, IRSGraphicsProvider <OpenTKRsGraphicsContext> graphicsObject) { method239(); }