MCPcopy Index your code
hub / github.com/benfry/processing4 / removeTexture

Method removeTexture

core/src/processing/opengl/PShapeOpenGL.java:864–891  ·  view source on GitHub ↗
(PImage tex, PShapeOpenGL caller)

Source from the content-addressed store, hash-verified

862
863
864 protected void removeTexture(PImage tex, PShapeOpenGL caller) {
865 if (textures == null || !textures.contains(tex)) return; // Nothing to remove.
866
867 // First check that none of the child shapes have texture tex...
868 boolean childHasTex = false;
869 for (int i = 0; i < childCount; i++) {
870 PShapeOpenGL child = (PShapeOpenGL) children[i];
871 if (child == caller) continue;
872 if (child.hasTexture(tex)) {
873 childHasTex = true;
874 break;
875 }
876 }
877
878 if (!childHasTex) {
879 // ...if not, it is safe to remove from this shape.
880 textures.remove(tex);
881 if (textures.size() == 0) {
882 textures = null;
883 }
884 }
885
886 // Since this shape and all its child shapes don't contain
887 // tex anymore, we now can remove it from the parent.
888 if (parent != null) {
889 ((PShapeOpenGL)parent).removeTexture(tex, this);
890 }
891 }
892
893
894 protected void strokedTexture(boolean newValue) {

Callers 1

setTextureImplMethod · 0.80

Calls 4

hasTextureMethod · 0.95
containsMethod · 0.45
removeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected