From e8a7ca4fc08d74eb4a1796920fe9268a88fb4c08 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 24 Oct 2021 06:33:36 +0300 Subject: Cleanup --- src/ui/documentwidget.c | 24 ------------------------ src/ui/paint.c | 15 --------------- src/ui/visbuf.c | 27 +-------------------------- 3 files changed, 1 insertion(+), 65 deletions(-) (limited to 'src/ui') 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) { arrange_Widget(d->footerButtons); } -#if 0 -iBool findCachedContent_DocumentWidget(const iDocumentWidget *d, const iString *url, - iString *mime_out, iBlock *data_out) { - if (equal_String(d->mod.url, url) && !isRequestOngoing_DocumentWidget(d)) { - /* It's the currently open page. */ - set_String(mime_out, &d->sourceMime); - set_Block(data_out, &d->sourceContent); - return iTrue; - } - /* Finished media requests are kept in memory while the page is open. */ - iConstForEach(ObjectList, i, d->media) { - const iMediaRequest *mr = i.object; - if (mr->req && - isFinished_GmRequest(mr->req) && - equal_String(linkUrl_GmDocument(d->doc, mr->linkId), url)) { - set_String(mime_out, meta_GmRequest(mr->req)); - set_Block(data_out, body_GmRequest(mr->req)); - return iTrue; - } - } - return iFalse; -} -#endif - iBeginDefineSubclass(DocumentWidget, Widget) .processEvent = (iAny *) processEvent_DocumentWidget_, .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) { } void setClip_Paint(iPaint *d, iRect rect) { - //rect = intersect_Rect(rect, rect_Root(get_Root())); addv_I2(&rect.pos, origin_Paint); if (isEmpty_Rect(rect)) { rect = init_Rect(0, 0, 1, 1); } -// iRect root = rect_Root(get_Root()); iRect targetRect = zero_Rect(); SDL_Texture *target = SDL_GetRenderTarget(renderer_Paint_(d)); if (target) { @@ -80,19 +78,6 @@ void setClip_Paint(iPaint *d, iRect rect) { else { rect = intersect_Rect(rect, rect_Root(get_Root())); } - - /*if (rect.pos.x < 0) { - adjustEdges_Rect(&rect, 0, 0, 0, -rect.pos.x); - } - if (rect.pos.y < 0) { - adjustEdges_Rect(&rect, -rect.pos.y, 0, 0, 0); - } - if (right_Rect(rect) > right_Rect(root)) { - adjustEdges_Rect(&rect, 0, right_Rect(root) - right_Rect(rect), 0, 0); - } - if (bottom_Rect(rect) > bottom_Rect(root)) { - adjustEdges_Rect(&rect, 0, bottom_Rect(root) - bottom_Rect(rect), 0, 0); - }*/ SDL_RenderSetClipRect(renderer_Paint_(d), (const SDL_Rect *) &rect); } 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) { } } -#if 0 -static size_t findMostDistant_VisBuf_(const iVisBuf *d, const size_t *avail, size_t numAvail, - const iRangei vis) { - size_t chosen = 0; - int distChosen = iAbsi(d->buffers[0].origin - vis.start); - printf(" avail (got %zu): %zu", numAvail, avail[0]); - for (size_t i = 1; i < numAvail; i++) { - printf(" %zu", avail[i]); - const int dist = iAbsi(d->buffers[i].origin - vis.start); - if (dist > distChosen) { - chosen = i; - distChosen = dist; - } - } - printf("\n chose index %zu (%d)\n", chosen, distChosen); - return chosen; -} - -static size_t take_(size_t *avail, size_t *numAvail, size_t index) { - const size_t value = avail[index]; - memmove(avail + index, avail + index + 1, sizeof(size_t) * (*numAvail - index - 1)); - (*numAvail)--; - return value; -} -#endif - static void roll_VisBuf_(iVisBuf *d, int dir) { const size_t lastPos = iElemCount(d->buffers) - 1; if (dir < 0) { @@ -170,6 +144,7 @@ iBool reposition_VisBuf(iVisBuf *d, const iRangei vis) { wasChanged = iTrue; } } + iUnused(wasChanged); #if 0 if (wasChanged) { printf("\nVISIBLE RANGE: %d ... %d\n", vis.start, vis.end); -- cgit v1.2.3