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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 intptr_t pixels = reinterpret_cast<intptr_t>(bmp.getPixels()); | 100 intptr_t pixels = reinterpret_cast<intptr_t>(bmp.getPixels()); |
101 for (int y = 0; y < DEV_H; ++y) { | 101 for (int y = 0; y < DEV_H; ++y) { |
102 for (int x = 0; x < DEV_W; ++x) { | 102 for (int x = 0; x < DEV_W; ++x) { |
103 SkPMColor* pixel = reinterpret_cast<SkPMColor*>(pixels + y * bmp
.rowBytes() + x * bmp.bytesPerPixel()); | 103 SkPMColor* pixel = reinterpret_cast<SkPMColor*>(pixels + y * bmp
.rowBytes() + x * bmp.bytesPerPixel()); |
104 *pixel = getCanvasColor(x, y); | 104 *pixel = getCanvasColor(x, y); |
105 } | 105 } |
106 } | 106 } |
107 } | 107 } |
108 canvas->save(); | 108 canvas->save(); |
109 canvas->setMatrix(SkMatrix::I()); | 109 canvas->setMatrix(SkMatrix::I()); |
110 canvas->clipRect(DEV_RECT_S, SkRegion::kReplace_Op); | 110 canvas->legacyClipRect(DEV_RECT_S, SkRegion::kReplace_Op); |
111 SkPaint paint; | 111 SkPaint paint; |
112 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 112 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
113 canvas->drawBitmap(bmp, 0, 0, &paint); | 113 canvas->drawBitmap(bmp, 0, 0, &paint); |
114 canvas->restore(); | 114 canvas->restore(); |
115 } | 115 } |
116 | 116 |
117 static void fillBitmap(SkBitmap* bitmap) { | 117 static void fillBitmap(SkBitmap* bitmap) { |
118 SkASSERT(bitmap->lockPixelsAreWritable()); | 118 SkASSERT(bitmap->lockPixelsAreWritable()); |
119 SkAutoLockPixels alp(*bitmap); | 119 SkAutoLockPixels alp(*bitmap); |
120 int w = bitmap->width(); | 120 int w = bitmap->width(); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 checkRead(reporter, wkbmp, clippedRect.fLeft, | 384 checkRead(reporter, wkbmp, clippedRect.fLeft, |
385 clippedRect.fTop, true, false); | 385 clippedRect.fTop, true, false); |
386 } else { | 386 } else { |
387 REPORTER_ASSERT(reporter, !success); | 387 REPORTER_ASSERT(reporter, !success); |
388 } | 388 } |
389 } | 389 } |
390 } | 390 } |
391 } | 391 } |
392 } | 392 } |
393 } | 393 } |
OLD | NEW |