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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 canvasInfo = secretDevBitmap.info(); | 206 canvasInfo = secretDevBitmap.info(); |
207 canvasRowBytes = secretDevBitmap.rowBytes(); | 207 canvasRowBytes = secretDevBitmap.rowBytes(); |
208 canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels()); | 208 canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels()); |
209 | 209 |
210 if (NULL == canvasPixels) { | 210 if (NULL == canvasPixels) { |
211 return false; | 211 return false; |
212 } | 212 } |
213 | 213 |
214 if (canvasInfo.width() != DEV_W || | 214 if (canvasInfo.width() != DEV_W || |
215 canvasInfo.height() != DEV_H || | 215 canvasInfo.height() != DEV_H || |
216 canvasInfo.colorType() != kN32_SkColorType) { | 216 canvasInfo.colorType() != kPMColor_SkColorType) { |
217 return false; | 217 return false; |
218 } | 218 } |
219 | 219 |
220 const SkImageInfo bmInfo = bitmap.info(); | 220 const SkImageInfo bmInfo = bitmap.info(); |
221 | 221 |
222 SkIRect writeRect = SkIRect::MakeXYWH(writeX, writeY, bitmap.width(), bitmap
.height()); | 222 SkIRect writeRect = SkIRect::MakeXYWH(writeX, writeY, bitmap.width(), bitmap
.height()); |
223 for (int cy = 0; cy < DEV_H; ++cy) { | 223 for (int cy = 0; cy < DEV_H; ++cy) { |
224 for (int cx = 0; cx < DEV_W; ++cx) { | 224 for (int cx = 0; cx < DEV_W; ++cx) { |
225 SkPMColor canvasPixel = canvasPixels[cx]; | 225 SkPMColor canvasPixel = canvasPixels[cx]; |
226 if (writeRect.contains(cx, cy)) { | 226 if (writeRect.contains(cx, cy)) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, | 462 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, |
463 bmp.width(), bmp.h
eight()); | 463 bmp.width(), bmp.h
eight()); |
464 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; | 464 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; |
465 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); | 465 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); |
466 } | 466 } |
467 } | 467 } |
468 } | 468 } |
469 } | 469 } |
470 } | 470 } |
471 } | 471 } |
OLD | NEW |