Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Side by Side Diff: src/core/SkDraw.cpp

Issue 147053003: fix (some) 64bit warnings -- size_t -> int (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkDebug.cpp ('k') | src/core/SkEdgeBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkBounder.h" 10 #include "SkBounder.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 typedef void (*BitmapXferProc)(void* pixels, size_t bytes, uint32_t data); 145 typedef void (*BitmapXferProc)(void* pixels, size_t bytes, uint32_t data);
146 146
147 static void D_Clear_BitmapXferProc(void* pixels, size_t bytes, uint32_t) { 147 static void D_Clear_BitmapXferProc(void* pixels, size_t bytes, uint32_t) {
148 sk_bzero(pixels, bytes); 148 sk_bzero(pixels, bytes);
149 } 149 }
150 150
151 static void D_Dst_BitmapXferProc(void*, size_t, uint32_t data) {} 151 static void D_Dst_BitmapXferProc(void*, size_t, uint32_t data) {}
152 152
153 static void D32_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { 153 static void D32_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) {
154 sk_memset32((uint32_t*)pixels, data, bytes >> 2); 154 sk_memset32((uint32_t*)pixels, data, SkToInt(bytes >> 2));
155 } 155 }
156 156
157 static void D16_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { 157 static void D16_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) {
158 sk_memset16((uint16_t*)pixels, data, bytes >> 1); 158 sk_memset16((uint16_t*)pixels, data, SkToInt(bytes >> 1));
159 } 159 }
160 160
161 static void DA8_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) { 161 static void DA8_Src_BitmapXferProc(void* pixels, size_t bytes, uint32_t data) {
162 memset(pixels, data, bytes); 162 memset(pixels, data, bytes);
163 } 163 }
164 164
165 static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap, 165 static BitmapXferProc ChooseBitmapXferProc(const SkBitmap& bitmap,
166 const SkPaint& paint, 166 const SkPaint& paint,
167 uint32_t* data) { 167 uint32_t* data) {
168 // todo: we can apply colorfilter up front if no shader, so we wouldn't 168 // todo: we can apply colorfilter up front if no shader, so we wouldn't
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return proc; 546 return proc;
547 } 547 }
548 548
549 static bool bounder_points(SkBounder* bounder, SkCanvas::PointMode mode, 549 static bool bounder_points(SkBounder* bounder, SkCanvas::PointMode mode,
550 size_t count, const SkPoint pts[], 550 size_t count, const SkPoint pts[],
551 const SkPaint& paint, const SkMatrix& matrix) { 551 const SkPaint& paint, const SkMatrix& matrix) {
552 SkIRect ibounds; 552 SkIRect ibounds;
553 SkRect bounds; 553 SkRect bounds;
554 SkScalar inset = paint.getStrokeWidth(); 554 SkScalar inset = paint.getStrokeWidth();
555 555
556 bounds.set(pts, count); 556 bounds.set(pts, SkToInt(count));
557 bounds.inset(-inset, -inset); 557 bounds.inset(-inset, -inset);
558 matrix.mapRect(&bounds); 558 matrix.mapRect(&bounds);
559 559
560 bounds.roundOut(&ibounds); 560 bounds.roundOut(&ibounds);
561 return bounder->doIRect(ibounds); 561 return bounder->doIRect(ibounds);
562 } 562 }
563 563
564 // each of these costs 8-bytes of stack space, so don't make it too large 564 // each of these costs 8-bytes of stack space, so don't make it too large
565 // must be even for lines/polygon to work 565 // must be even for lines/polygon to work
566 #define MAX_DEV_PTS 32 566 #define MAX_DEV_PTS 32
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); 603 SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint);
604 604
605 SkPoint devPts[MAX_DEV_PTS]; 605 SkPoint devPts[MAX_DEV_PTS];
606 const SkMatrix* matrix = fMatrix; 606 const SkMatrix* matrix = fMatrix;
607 SkBlitter* bltr = blitter.get(); 607 SkBlitter* bltr = blitter.get();
608 PtProcRec::Proc proc = rec.chooseProc(&bltr); 608 PtProcRec::Proc proc = rec.chooseProc(&bltr);
609 // we have to back up subsequent passes if we're in polygon mode 609 // we have to back up subsequent passes if we're in polygon mode
610 const size_t backup = (SkCanvas::kPolygon_PointMode == mode); 610 const size_t backup = (SkCanvas::kPolygon_PointMode == mode);
611 611
612 do { 612 do {
613 size_t n = count; 613 int n = SkToInt(count);
614 if (n > MAX_DEV_PTS) { 614 if (n > MAX_DEV_PTS) {
615 n = MAX_DEV_PTS; 615 n = MAX_DEV_PTS;
616 } 616 }
617 matrix->mapPoints(devPts, pts, n); 617 matrix->mapPoints(devPts, pts, n);
618 proc(rec, devPts, n, bltr); 618 proc(rec, devPts, n, bltr);
619 pts += n - backup; 619 pts += n - backup;
620 SkASSERT(count >= n); 620 SkASSERT(SkToInt(count) >= n);
621 count -= n; 621 count -= n;
622 if (count > 0) { 622 if (count > 0) {
623 count += backup; 623 count += backup;
624 } 624 }
625 } while (count != 0); 625 } while (count != 0);
626 } else { 626 } else {
627 switch (mode) { 627 switch (mode) {
628 case SkCanvas::kPoints_PointMode: { 628 case SkCanvas::kPoints_PointMode: {
629 // temporarily mark the paint as filling. 629 // temporarily mark the paint as filling.
630 SkPaint newPaint(paint); 630 SkPaint newPaint(paint);
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 mask->fImage = SkMask::AllocImage(size); 2820 mask->fImage = SkMask::AllocImage(size);
2821 memset(mask->fImage, 0, mask->computeImageSize()); 2821 memset(mask->fImage, 0, mask->computeImageSize());
2822 } 2822 }
2823 2823
2824 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2824 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2825 draw_into_mask(*mask, devPath, style); 2825 draw_into_mask(*mask, devPath, style);
2826 } 2826 }
2827 2827
2828 return true; 2828 return true;
2829 } 2829 }
OLDNEW
« no previous file with comments | « src/core/SkDebug.cpp ('k') | src/core/SkEdgeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698