Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: tests/ReadPixelsTest.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/WritePixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698