Mercurial > sdl-ios-xcode
comparison src/render/software/SDL_renderer_sw.c @ 5160:657543cc92f9
Making the API simpler, removed the writepixels interface
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 03 Feb 2011 00:22:18 -0800 |
parents | 307ccc9c135e |
children | d72793305335 |
comparison
equal
deleted
inserted
replaced
5159:307ccc9c135e | 5160:657543cc92f9 |
---|---|
51 const SDL_Rect ** rects, int count); | 51 const SDL_Rect ** rects, int count); |
52 static int SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, | 52 static int SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
53 const SDL_Rect * srcrect, const SDL_Rect * dstrect); | 53 const SDL_Rect * srcrect, const SDL_Rect * dstrect); |
54 static int SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, | 54 static int SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
55 Uint32 format, void * pixels, int pitch); | 55 Uint32 format, void * pixels, int pitch); |
56 static int SW_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, | |
57 Uint32 format, const void * pixels, int pitch); | |
58 static void SW_RenderPresent(SDL_Renderer * renderer); | 56 static void SW_RenderPresent(SDL_Renderer * renderer); |
59 static void SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); | 57 static void SW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
60 static void SW_DestroyRenderer(SDL_Renderer * renderer); | 58 static void SW_DestroyRenderer(SDL_Renderer * renderer); |
61 | 59 |
62 | 60 |
164 renderer->RenderDrawPoints = SW_RenderDrawPoints; | 162 renderer->RenderDrawPoints = SW_RenderDrawPoints; |
165 renderer->RenderDrawLines = SW_RenderDrawLines; | 163 renderer->RenderDrawLines = SW_RenderDrawLines; |
166 renderer->RenderFillRects = SW_RenderFillRects; | 164 renderer->RenderFillRects = SW_RenderFillRects; |
167 renderer->RenderCopy = SW_RenderCopy; | 165 renderer->RenderCopy = SW_RenderCopy; |
168 renderer->RenderReadPixels = SW_RenderReadPixels; | 166 renderer->RenderReadPixels = SW_RenderReadPixels; |
169 renderer->RenderWritePixels = SW_RenderWritePixels; | |
170 renderer->RenderPresent = SW_RenderPresent; | 167 renderer->RenderPresent = SW_RenderPresent; |
171 renderer->DestroyRenderer = SW_DestroyRenderer; | 168 renderer->DestroyRenderer = SW_DestroyRenderer; |
172 renderer->info = SW_RenderDriver.info; | 169 renderer->info = SW_RenderDriver.info; |
173 renderer->info.flags = 0; | 170 renderer->info.flags = 0; |
174 renderer->window = window; | 171 renderer->window = window; |
590 | 587 |
591 data->renderer->UnlockTexture(data->renderer, data->texture); | 588 data->renderer->UnlockTexture(data->renderer, data->texture); |
592 return 0; | 589 return 0; |
593 } | 590 } |
594 | 591 |
595 static int | |
596 SW_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, | |
597 Uint32 format, const void * pixels, int pitch) | |
598 { | |
599 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; | |
600 | |
601 if (!SW_ActivateRenderer(renderer)) { | |
602 return -1; | |
603 } | |
604 | |
605 if (data->renderer->LockTexture(data->renderer, data->texture, rect, | |
606 &data->surface.pixels, | |
607 &data->surface.pitch) < 0) { | |
608 return -1; | |
609 } | |
610 | |
611 SDL_ConvertPixels(rect->w, rect->h, format, pixels, pitch, | |
612 data->format, data->surface.pixels, data->surface.pitch); | |
613 | |
614 data->renderer->UnlockTexture(data->renderer, data->texture); | |
615 return 0; | |
616 } | |
617 | |
618 static void | 592 static void |
619 SW_RenderPresent(SDL_Renderer * renderer) | 593 SW_RenderPresent(SDL_Renderer * renderer) |
620 { | 594 { |
621 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; | 595 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; |
622 SDL_Texture *texture = SW_ActivateRenderer(renderer); | 596 SDL_Texture *texture = SW_ActivateRenderer(renderer); |