mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Factor out code that fires the captureEvent.
This commit is contained in:
@@ -1018,20 +1018,9 @@ public class Capture extends PImage implements PConstants {
|
||||
return;
|
||||
}
|
||||
|
||||
// Creates a captureEvent.
|
||||
if (captureEventMethod != null) {
|
||||
try {
|
||||
captureEventMethod.invoke(eventHandler, this);
|
||||
} catch (Exception e) {
|
||||
System.err.println(
|
||||
"error, disabling captureEvent() for capture object");
|
||||
e.printStackTrace();
|
||||
captureEventMethod = null;
|
||||
}
|
||||
}
|
||||
fireCaptureEvent();
|
||||
}
|
||||
|
||||
|
||||
protected synchronized void invokeEvent(int w, int h, Buffer buffer) {
|
||||
available = true;
|
||||
bufWidth = w;
|
||||
@@ -1044,6 +1033,10 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
natBuffer = buffer;
|
||||
|
||||
fireCaptureEvent();
|
||||
}
|
||||
|
||||
private void fireCaptureEvent() {
|
||||
// Creates a captureEvent.
|
||||
if (captureEventMethod != null) {
|
||||
try {
|
||||
@@ -1057,7 +1050,6 @@ public class Capture extends PImage implements PConstants {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// Stream query methods.
|
||||
|
||||
Reference in New Issue
Block a user