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

Unified Diff: samplecode/SampleApp.cpp

Issue 1292943003: support both box and circle lcd (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698