MCPcopy Index your code
hub / github.com/processing/processing / fillEdges

Method fillEdges

core/src/processing/opengl/Texture.java:1478–1514  ·  view source on GitHub ↗
(int x, int y, int w, int h)

Source from the content-addressed store, hash-verified

1476
1477
1478 protected void fillEdges(int x, int y, int w, int h) {
1479 if ((width < glWidth || height < glHeight) && (x + w == width || y + h == height)) {
1480 if (x + w == width) {
1481 int ew = glWidth - width;
1482 edgePixels = new int[h * ew];
1483 for (int i = 0; i < h; i++) {
1484 int c = rgbaPixels[i * w + (w - 1)];
1485 Arrays.fill(edgePixels, i * ew, (i + 1) * ew, c);
1486 }
1487 edgeBuffer = PGL.updateIntBuffer(edgeBuffer, edgePixels, true);
1488 pgl.texSubImage2D(glTarget, 0, width, y, ew, h, PGL.RGBA,
1489 PGL.UNSIGNED_BYTE, edgeBuffer);
1490 }
1491
1492 if (y + h == height) {
1493 int eh = glHeight - height;
1494 edgePixels = new int[eh * w];
1495 for (int i = 0; i < eh; i++) {
1496 System.arraycopy(rgbaPixels, (h - 1) * w, edgePixels, i * w, w);
1497 }
1498 edgeBuffer = PGL.updateIntBuffer(edgeBuffer, edgePixels, true);
1499 pgl.texSubImage2D(glTarget, 0, x, height, w, eh, PGL.RGBA,
1500 PGL.UNSIGNED_BYTE, edgeBuffer);
1501 }
1502
1503 if (x + w == width && y + h == height) {
1504 int ew = glWidth - width;
1505 int eh = glHeight - height;
1506 int c = rgbaPixels[w * h - 1];
1507 edgePixels = new int[eh * ew];
1508 Arrays.fill(edgePixels, 0, eh * ew, c);
1509 edgeBuffer = PGL.updateIntBuffer(edgeBuffer, edgePixels, true);
1510 pgl.texSubImage2D(glTarget, 0, width, height, ew, eh, PGL.RGBA,
1511 PGL.UNSIGNED_BYTE, edgeBuffer);
1512 }
1513 }
1514 }
1515
1516 ///////////////////////////////////////////////////////////////////////////
1517

Callers 2

setMethod · 0.95
setNativeMethod · 0.95

Calls 4

updateIntBufferMethod · 0.95
arraycopyMethod · 0.80
fillMethod · 0.45
texSubImage2DMethod · 0.45

Tested by

no test coverage detected