OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "OverView.h" | 10 #include "OverView.h" |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 SkIRect src; | 1109 SkIRect src; |
1110 src.set(0, 0, zoomedWidth / fFatBitsScale, zoomedHeight / fFatBitsScale)
; | 1110 src.set(0, 0, zoomedWidth / fFatBitsScale, zoomedHeight / fFatBitsScale)
; |
1111 src.offset(fMouseX - (src.width()>>1), fMouseY - (src.height()>>1)); | 1111 src.offset(fMouseX - (src.width()>>1), fMouseY - (src.height()>>1)); |
1112 SkRect dest; | 1112 SkRect dest; |
1113 dest.set(0, 0, SkIntToScalar(zoomedWidth), SkIntToScalar(zoomedHeight)); | 1113 dest.set(0, 0, SkIntToScalar(zoomedWidth), SkIntToScalar(zoomedHeight)); |
1114 dest.offset(SkIntToScalar(width - zoomedWidth), SkIntToScalar(height - z
oomedHeight)); | 1114 dest.offset(SkIntToScalar(width - zoomedWidth), SkIntToScalar(height - z
oomedHeight)); |
1115 SkPaint paint; | 1115 SkPaint paint; |
1116 // Clear the background behind our zoomed in view | 1116 // Clear the background behind our zoomed in view |
1117 paint.setColor(SK_ColorWHITE); | 1117 paint.setColor(SK_ColorWHITE); |
1118 canvas->drawRect(dest, paint); | 1118 canvas->drawRect(dest, paint); |
1119 canvas->drawBitmapRect(bitmap, src, dest, NULL); | 1119 canvas->drawBitmapRect(bitmap, &src, dest); |
1120 paint.setColor(SK_ColorBLACK); | 1120 paint.setColor(SK_ColorBLACK); |
1121 paint.setStyle(SkPaint::kStroke_Style); | 1121 paint.setStyle(SkPaint::kStroke_Style); |
1122 // Draw a border around the pixel in the middle | 1122 // Draw a border around the pixel in the middle |
1123 SkRect originalPixel; | 1123 SkRect originalPixel; |
1124 originalPixel.set(SkIntToScalar(fMouseX), SkIntToScalar(fMouseY), SkIntT
oScalar(fMouseX + 1), SkIntToScalar(fMouseY + 1)); | 1124 originalPixel.set(SkIntToScalar(fMouseX), SkIntToScalar(fMouseY), SkIntT
oScalar(fMouseX + 1), SkIntToScalar(fMouseY + 1)); |
1125 SkMatrix matrix; | 1125 SkMatrix matrix; |
1126 SkRect scalarSrc; | 1126 SkRect scalarSrc; |
1127 scalarSrc.set(src); | 1127 scalarSrc.set(src); |
1128 SkColor color = bitmap.getColor(fMouseX, fMouseY); | 1128 SkColor color = bitmap.getColor(fMouseX, fMouseY); |
1129 if (matrix.setRectToRect(scalarSrc, dest, SkMatrix::kFill_ScaleToFit)) { | 1129 if (matrix.setRectToRect(scalarSrc, dest, SkMatrix::kFill_ScaleToFit)) { |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2303 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2304 #endif | 2304 #endif |
2305 SkGraphics::Init(); | 2305 SkGraphics::Init(); |
2306 SkEvent::Init(); | 2306 SkEvent::Init(); |
2307 } | 2307 } |
2308 | 2308 |
2309 void application_term() { | 2309 void application_term() { |
2310 SkEvent::Term(); | 2310 SkEvent::Term(); |
2311 SkGraphics::Term(); | 2311 SkGraphics::Term(); |
2312 } | 2312 } |
OLD | NEW |