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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 if (bmp.isNull()) { | 117 if (bmp.isNull()) { |
118 bmp.allocN32Pixels(DEV_W, DEV_H); | 118 bmp.allocN32Pixels(DEV_W, DEV_H); |
119 for (int y = 0; y < DEV_H; ++y) { | 119 for (int y = 0; y < DEV_H; ++y) { |
120 for (int x = 0; x < DEV_W; ++x) { | 120 for (int x = 0; x < DEV_W; ++x) { |
121 *bmp.getAddr32(x, y) = getCanvasColor(x, y); | 121 *bmp.getAddr32(x, y) = getCanvasColor(x, y); |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 canvas->save(); | 125 canvas->save(); |
126 canvas->setMatrix(SkMatrix::I()); | 126 canvas->setMatrix(SkMatrix::I()); |
127 canvas->clipRect(DEV_RECT_S, SkRegion::kReplace_Op); | 127 canvas->legacyClipRect(DEV_RECT_S, SkRegion::kReplace_Op); |
128 SkPaint paint; | 128 SkPaint paint; |
129 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 129 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
130 canvas->drawBitmap(bmp, 0, 0, &paint); | 130 canvas->drawBitmap(bmp, 0, 0, &paint); |
131 canvas->restore(); | 131 canvas->restore(); |
132 } | 132 } |
133 | 133 |
134 /** | 134 /** |
135 * Lucky for us, alpha is always in the same spot (SK_A32_SHIFT), for both RGBA
and BGRA. | 135 * Lucky for us, alpha is always in the same spot (SK_A32_SHIFT), for both RGBA
and BGRA. |
136 * Thus this routine doesn't need to know the exact colortype | 136 * Thus this routine doesn't need to know the exact colortype |
137 */ | 137 */ |
(...skipping 333 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 |