Index: samplecode/SampleApp.cpp |
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp |
index 55a9aaceb93bc34fbbffa44d6e86b82c66bd42a4..ae9c88b7da722f67920a932c9c2a59d6e0c496e2 100644 |
--- a/samplecode/SampleApp.cpp |
+++ b/samplecode/SampleApp.cpp |
@@ -1121,7 +1121,7 @@ typedef void (*ShowLCDProc)(SkCanvas*, SkScalar, SkScalar, SkColor, SkScalar, Sk |
* Like drawBitmapRect but we manually draw each pixels in RGB |
*/ |
static void show_lcd_grid(SkCanvas* canvas, const SkBitmap& bitmap, |
- const SkIRect& origSrc, const SkRect& dst) { |
+ const SkIRect& origSrc, const SkRect& dst, ShowLCDProc proc) { |
SkIRect src; |
if (!src.intersect(origSrc, bitmap.bounds())) { |
return; |
@@ -1133,11 +1133,6 @@ static void show_lcd_grid(SkCanvas* canvas, const SkBitmap& bitmap, |
canvas->translate(dst.left(), dst.top()); |
canvas->scale(sx, sy); |
- ShowLCDProc proc = show_lcd_box; |
- if (true) { |
- proc = show_lcd_circle; |
- } |
- |
for (int y = 0; y < src.height(); ++y) { |
for (int x = 0; x < src.width(); ++x) { |
proc(canvas, SkIntToScalar(x), SkIntToScalar(y), |
@@ -1173,10 +1168,16 @@ void SampleWindow::showZoomer(SkCanvas* canvas) { |
// Clear the background behind our zoomed in view |
paint.setColor(SK_ColorWHITE); |
canvas->drawRect(dest, paint); |
- if (fFatBitsScale < kMaxFatBitsScale) { |
- canvas->drawBitmapRect(bitmap, src, dest, NULL); |
- } else { |
- show_lcd_grid(canvas, bitmap, src, dest); |
+ switch (fFatBitsScale) { |
+ case kMaxFatBitsScale: |
+ show_lcd_grid(canvas, bitmap, src, dest, show_lcd_box); |
+ break; |
+ case kMaxFatBitsScale - 1: |
+ show_lcd_grid(canvas, bitmap, src, dest, show_lcd_circle); |
+ break; |
+ default: |
+ canvas->drawBitmapRect(bitmap, src, dest, NULL); |
+ break; |
} |
paint.setColor(SK_ColorBLACK); |