src/render/software/SDL_render_sw.c
changeset 6529 9094fcfd378d
parent 6528 e978048ced60
child 6885 700f1b25f77f
equal deleted inserted replaced
6528:e978048ced60 6529:9094fcfd378d
   359     if (!final_points) {
   359     if (!final_points) {
   360         SDL_OutOfMemory();
   360         SDL_OutOfMemory();
   361         return -1;
   361         return -1;
   362     }
   362     }
   363     if (renderer->viewport.x || renderer->viewport.y) {
   363     if (renderer->viewport.x || renderer->viewport.y) {
   364         float x = renderer->viewport.x * renderer->scale.x;
   364         int x = renderer->viewport.x;
   365         float y = renderer->viewport.y * renderer->scale.y;
   365         int y = renderer->viewport.y;
   366 
   366 
   367         for (i = 0; i < count; ++i) {
   367         for (i = 0; i < count; ++i) {
   368             final_points[i].x = (int)(x + points[i].x);
   368             final_points[i].x = (int)(x + points[i].x);
   369             final_points[i].y = (int)(y + points[i].y);
   369             final_points[i].y = (int)(y + points[i].y);
   370         }
   370         }
   409     if (!final_points) {
   409     if (!final_points) {
   410         SDL_OutOfMemory();
   410         SDL_OutOfMemory();
   411         return -1;
   411         return -1;
   412     }
   412     }
   413     if (renderer->viewport.x || renderer->viewport.y) {
   413     if (renderer->viewport.x || renderer->viewport.y) {
   414         float x = renderer->viewport.x * renderer->scale.x;
   414         int x = renderer->viewport.x;
   415         float y = renderer->viewport.y * renderer->scale.y;
   415         int y = renderer->viewport.y;
   416 
   416 
   417         for (i = 0; i < count; ++i) {
   417         for (i = 0; i < count; ++i) {
   418             final_points[i].x = (int)(x + points[i].x);
   418             final_points[i].x = (int)(x + points[i].x);
   419             final_points[i].y = (int)(y + points[i].y);
   419             final_points[i].y = (int)(y + points[i].y);
   420         }
   420         }
   458     if (!final_rects) {
   458     if (!final_rects) {
   459         SDL_OutOfMemory();
   459         SDL_OutOfMemory();
   460         return -1;
   460         return -1;
   461     }
   461     }
   462     if (renderer->viewport.x || renderer->viewport.y) {
   462     if (renderer->viewport.x || renderer->viewport.y) {
   463         float x = renderer->viewport.x * renderer->scale.x;
   463         int x = renderer->viewport.x;
   464         float y = renderer->viewport.y * renderer->scale.y;
   464         int y = renderer->viewport.y;
   465 
   465 
   466         for (i = 0; i < count; ++i) {
   466         for (i = 0; i < count; ++i) {
   467             final_rects[i].x = (int)(x + rects[i].x);
   467             final_rects[i].x = (int)(x + rects[i].x);
   468             final_rects[i].y = (int)(y + rects[i].y);
   468             final_rects[i].y = (int)(y + rects[i].y);
   469             final_rects[i].w = SDL_max((int)rects[i].w, 1);
   469             final_rects[i].w = SDL_max((int)rects[i].w, 1);
   505     if (!surface) {
   505     if (!surface) {
   506         return -1;
   506         return -1;
   507     }
   507     }
   508 
   508 
   509     if (renderer->viewport.x || renderer->viewport.y) {
   509     if (renderer->viewport.x || renderer->viewport.y) {
   510         final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
   510         final_rect.x = (int)(renderer->viewport.x + dstrect->x);
   511         final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
   511         final_rect.y = (int)(renderer->viewport.y + dstrect->y);
   512     } else {
   512     } else {
   513         final_rect.x = (int)dstrect->x;
   513         final_rect.x = (int)dstrect->x;
   514         final_rect.y = (int)dstrect->y;
   514         final_rect.y = (int)dstrect->y;
   515     }
   515     }
   516     final_rect.w = (int)dstrect->w;
   516     final_rect.w = (int)dstrect->w;
   551     if (!surface) {
   551     if (!surface) {
   552         return -1;
   552         return -1;
   553     }
   553     }
   554 
   554 
   555     if (renderer->viewport.x || renderer->viewport.y) {
   555     if (renderer->viewport.x || renderer->viewport.y) {
   556         final_rect.x = (int)((renderer->viewport.x * renderer->scale.x) + dstrect->x);
   556         final_rect.x = (int)(renderer->viewport.x + dstrect->x);
   557         final_rect.y = (int)((renderer->viewport.y * renderer->scale.y) + dstrect->y);
   557         final_rect.y = (int)(renderer->viewport.y + dstrect->y);
   558     } else {
   558     } else {
   559         final_rect.x = (int)dstrect->x;
   559         final_rect.x = (int)dstrect->x;
   560         final_rect.y = (int)dstrect->y;
   560         final_rect.y = (int)dstrect->y;
   561     }
   561     }
   562     final_rect.w = (int)dstrect->w;
   562     final_rect.w = (int)dstrect->w;