| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 r = SkMulDiv255Ceiling(r, a); | 108 r = SkMulDiv255Ceiling(r, a); |
| 109 g = SkMulDiv255Ceiling(g, a); | 109 g = SkMulDiv255Ceiling(g, a); |
| 110 b = SkMulDiv255Ceiling(b, a); | 110 b = SkMulDiv255Ceiling(b, a); |
| 111 } | 111 } |
| 112 return packColorType(ct, a, r, g , b); | 112 return packColorType(ct, a, r, g , b); |
| 113 } | 113 } |
| 114 | 114 |
| 115 static void fillCanvas(SkCanvas* canvas) { | 115 static void fillCanvas(SkCanvas* canvas) { |
| 116 SkBitmap bmp; | 116 SkBitmap bmp; |
| 117 if (bmp.isNull()) { | 117 if (bmp.isNull()) { |
| 118 SkDEBUGCODE(bool alloc = ) bmp.allocN32Pixels(DEV_W, DEV_H); | 118 bmp.allocN32Pixels(DEV_W, DEV_H); |
| 119 SkASSERT(alloc); | |
| 120 for (int y = 0; y < DEV_H; ++y) { | 119 for (int y = 0; y < DEV_H; ++y) { |
| 121 for (int x = 0; x < DEV_W; ++x) { | 120 for (int x = 0; x < DEV_W; ++x) { |
| 122 *bmp.getAddr32(x, y) = getCanvasColor(x, y); | 121 *bmp.getAddr32(x, y) = getCanvasColor(x, y); |
| 123 } | 122 } |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 canvas->save(); | 125 canvas->save(); |
| 127 canvas->setMatrix(SkMatrix::I()); | 126 canvas->setMatrix(SkMatrix::I()); |
| 128 canvas->clipRect(DEV_RECT_S, SkRegion::kReplace_Op); | 127 canvas->clipRect(DEV_RECT_S, SkRegion::kReplace_Op); |
| 129 SkPaint paint; | 128 SkPaint paint; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, | 471 SkIRect writeRect = SkIRect::MakeXYWH(rect.fLeft, rect.f
Top, |
| 473 bmp.width(), bmp.h
eight()); | 472 bmp.width(), bmp.h
eight()); |
| 474 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; | 473 bool intersects = SkIRect::Intersects(canvasRect, writeR
ect) ; |
| 475 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); | 474 REPORTER_ASSERT(reporter, intersects == (idBefore != idA
fter)); |
| 476 } | 475 } |
| 477 } | 476 } |
| 478 } | 477 } |
| 479 } | 478 } |
| 480 } | 479 } |
| 481 } | 480 } |
| OLD | NEW |