| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 static bool check_write(skiatest::Reporter* reporter, SkCanvas* canvas, const Sk
Bitmap& bitmap, | 188 static bool check_write(skiatest::Reporter* reporter, SkCanvas* canvas, const Sk
Bitmap& bitmap, |
| 189 int writeX, int writeY) { | 189 int writeX, int writeY) { |
| 190 const SkImageInfo canvasInfo = canvas->imageInfo(); | 190 const SkImageInfo canvasInfo = canvas->imageInfo(); |
| 191 size_t canvasRowBytes; | 191 size_t canvasRowBytes; |
| 192 const uint32_t* canvasPixels; | 192 const uint32_t* canvasPixels; |
| 193 | 193 |
| 194 // Can't use canvas->peekPixels(), as we are trying to look at GPU pixels so
metimes as well. | 194 // Can't use canvas->peekPixels(), as we are trying to look at GPU pixels so
metimes as well. |
| 195 // At some point this will be unsupported, as we won't allow accessBitmap()
to magically call | 195 // At some point this will be unsupported, as we won't allow accessBitmap()
to magically call |
| 196 // readPixels for the client. | 196 // readPixels for the client. |
| 197 SkBitmap secretDevBitmap; | 197 SkBitmap secretDevBitmap; |
| 198 canvas->readPixels(SkIRect::MakeWH(canvasInfo.width(), canvasInfo.height()),
&secretDevBitmap); | 198 canvas->readPixels(canvasInfo.bounds(), &secretDevBitmap); |
| 199 | 199 |
| 200 SkAutoLockPixels alp(secretDevBitmap); | 200 SkAutoLockPixels alp(secretDevBitmap); |
| 201 canvasRowBytes = secretDevBitmap.rowBytes(); | 201 canvasRowBytes = secretDevBitmap.rowBytes(); |
| 202 canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels()); | 202 canvasPixels = static_cast<const uint32_t*>(secretDevBitmap.getPixels()); |
| 203 | 203 |
| 204 if (NULL == canvasPixels) { | 204 if (NULL == canvasPixels) { |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (canvasInfo.width() != DEV_W || | 208 if (canvasInfo.width() != DEV_W || |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, | 471 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, |
| 472 bmp.width(), bmp.h
eight()); | 472 bmp.width(), bmp.h
eight()); |
| 473 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; | 473 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; |
| 474 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); | 474 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 } | 480 } |
| OLD | NEW |