summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-24 06:33:36 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-24 06:33:36 +0300
commite8a7ca4fc08d74eb4a1796920fe9268a88fb4c08 (patch)
treed8aedb9559de0a5acab8cb4634d6d406f4fbd629
parent7df7930c5514a74ebe5ee84682bfca8aa1034319 (diff)
Cleanup
-rw-r--r--src/ui/documentwidget.c24
-rw-r--r--src/ui/paint.c15
-rw-r--r--src/ui/visbuf.c27
3 files changed, 1 insertions, 65 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index aceae0fa..963bae8f 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -5280,30 +5280,6 @@ void updateSize_DocumentWidget(iDocumentWidget *d) {
5280 arrange_Widget(d->footerButtons); 5280 arrange_Widget(d->footerButtons);
5281} 5281}
5282 5282
5283#if 0
5284iBool findCachedContent_DocumentWidget(const iDocumentWidget *d, const iString *url,
5285 iString *mime_out, iBlock *data_out) {
5286 if (equal_String(d->mod.url, url) && !isRequestOngoing_DocumentWidget(d)) {
5287 /* It's the currently open page. */
5288 set_String(mime_out, &d->sourceMime);
5289 set_Block(data_out, &d->sourceContent);
5290 return iTrue;
5291 }
5292 /* Finished media requests are kept in memory while the page is open. */
5293 iConstForEach(ObjectList, i, d->media) {
5294 const iMediaRequest *mr = i.object;
5295 if (mr->req &&
5296 isFinished_GmRequest(mr->req) &&
5297 equal_String(linkUrl_GmDocument(d->doc, mr->linkId), url)) {
5298 set_String(mime_out, meta_GmRequest(mr->req));
5299 set_Block(data_out, body_GmRequest(mr->req));
5300 return iTrue;
5301 }
5302 }
5303 return iFalse;
5304}
5305#endif
5306
5307iBeginDefineSubclass(DocumentWidget, Widget) 5283iBeginDefineSubclass(DocumentWidget, Widget)
5308 .processEvent = (iAny *) processEvent_DocumentWidget_, 5284 .processEvent = (iAny *) processEvent_DocumentWidget_,
5309 .draw = (iAny *) draw_DocumentWidget_, 5285 .draw = (iAny *) draw_DocumentWidget_,
diff --git a/src/ui/paint.c b/src/ui/paint.c
index 5506f845..b92be27e 100644
--- a/src/ui/paint.c
+++ b/src/ui/paint.c
@@ -65,12 +65,10 @@ void endTarget_Paint(iPaint *d) {
65} 65}
66 66
67void setClip_Paint(iPaint *d, iRect rect) { 67void setClip_Paint(iPaint *d, iRect rect) {
68 //rect = intersect_Rect(rect, rect_Root(get_Root()));
69 addv_I2(&rect.pos, origin_Paint); 68 addv_I2(&rect.pos, origin_Paint);
70 if (isEmpty_Rect(rect)) { 69 if (isEmpty_Rect(rect)) {
71 rect = init_Rect(0, 0, 1, 1); 70 rect = init_Rect(0, 0, 1, 1);
72 } 71 }
73// iRect root = rect_Root(get_Root());
74 iRect targetRect = zero_Rect(); 72 iRect targetRect = zero_Rect();
75 SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); 73 SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d));
76 if (target) { 74 if (target) {
@@ -80,19 +78,6 @@ void setClip_Paint(iPaint *d, iRect rect) {
80 else { 78 else {
81 rect = intersect_Rect(rect, rect_Root(get_Root())); 79 rect = intersect_Rect(rect, rect_Root(get_Root()));
82 } 80 }
83
84 /*if (rect.pos.x < 0) {
85 adjustEdges_Rect(&rect, 0, 0, 0, -rect.pos.x);
86 }
87 if (rect.pos.y < 0) {
88 adjustEdges_Rect(&rect, -rect.pos.y, 0, 0, 0);
89 }
90 if (right_Rect(rect) > right_Rect(root)) {
91 adjustEdges_Rect(&rect, 0, right_Rect(root) - right_Rect(rect), 0, 0);
92 }
93 if (bottom_Rect(rect) > bottom_Rect(root)) {
94 adjustEdges_Rect(&rect, 0, bottom_Rect(root) - bottom_Rect(rect), 0, 0);
95 }*/
96 SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); 81 SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect);
97} 82}
98 83
diff --git a/src/ui/visbuf.c b/src/ui/visbuf.c
index 503d0a2f..8f7a4c46 100644
--- a/src/ui/visbuf.c
+++ b/src/ui/visbuf.c
@@ -79,32 +79,6 @@ void dealloc_VisBuf(iVisBuf *d) {
79 } 79 }
80} 80}
81 81
82#if 0
83static size_t findMostDistant_VisBuf_(const iVisBuf *d, const size_t *avail, size_t numAvail,
84 const iRangei vis) {
85 size_t chosen = 0;
86 int distChosen = iAbsi(d->buffers[0].origin - vis.start);
87 printf(" avail (got %zu): %zu", numAvail, avail[0]);
88 for (size_t i = 1; i < numAvail; i++) {
89 printf(" %zu", avail[i]);
90 const int dist = iAbsi(d->buffers[i].origin - vis.start);
91 if (dist > distChosen) {
92 chosen = i;
93 distChosen = dist;
94 }
95 }
96 printf("\n chose index %zu (%d)\n", chosen, distChosen);
97 return chosen;
98}
99
100static size_t take_(size_t *avail, size_t *numAvail, size_t index) {
101 const size_t value = avail[index];
102 memmove(avail + index, avail + index + 1, sizeof(size_t) * (*numAvail - index - 1));
103 (*numAvail)--;
104 return value;
105}
106#endif
107
108static void roll_VisBuf_(iVisBuf *d, int dir) { 82static void roll_VisBuf_(iVisBuf *d, int dir) {
109 const size_t lastPos = iElemCount(d->buffers) - 1; 83 const size_t lastPos = iElemCount(d->buffers) - 1;
110 if (dir < 0) { 84 if (dir < 0) {
@@ -170,6 +144,7 @@ iBool reposition_VisBuf(iVisBuf *d, const iRangei vis) {
170 wasChanged = iTrue; 144 wasChanged = iTrue;
171 } 145 }
172 } 146 }
147 iUnused(wasChanged);
173#if 0 148#if 0
174 if (wasChanged) { 149 if (wasChanged) {
175 printf("\nVISIBLE RANGE: %d ... %d\n", vis.start, vis.end); 150 printf("\nVISIBLE RANGE: %d ... %d\n", vis.start, vis.end);