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

Side by Side Diff: tests/ReadPixelsTest.cpp

Issue 1255483005: Attempt to somewhat simplify GrContext::readSurfacePixels interaction with GrGpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 5 years, 5 months 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 | « src/gpu/gl/GrGLGpu.cpp ('k') | no next file » | 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkMathPriv.h" 10 #include "SkMathPriv.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 int devx = bx + srcRect.fLeft; 191 int devx = bx + srcRect.fLeft;
192 int devy = by + srcRect.fTop; 192 int devy = by + srcRect.fTop;
193 193
194 const uint32_t* pixel = bitmap.getAddr32(bx, by); 194 const uint32_t* pixel = bitmap.getAddr32(bx, by);
195 195
196 if (clippedSrcRect.contains(devx, devy)) { 196 if (clippedSrcRect.contains(devx, devy)) {
197 if (checkCanvasPixels) { 197 if (checkCanvasPixels) {
198 SkPMColor canvasPixel = get_src_color(devx, devy); 198 SkPMColor canvasPixel = get_src_color(devx, devy);
199 bool didPremul; 199 bool didPremul;
200 SkPMColor pmPixel = convert_to_pmcolor(ct, at, pixel, &didPr emul); 200 SkPMColor pmPixel = convert_to_pmcolor(ct, at, pixel, &didPr emul);
201 bool check = check_read_pixel(pmPixel, canvasPixel, didPremu l); 201 if (!check_read_pixel(pmPixel, canvasPixel, didPremul)) {
202 REPORTER_ASSERT(reporter, check); 202 ERRORF(reporter, "Expected readback pixel value 0x%08x, got 0x%08x. "
203 if (!check) { 203 "Readback was unpremul: %d", canvasPixel, pmPixel , didPremul);
204 return false; 204 return false;
205 } 205 }
206 } 206 }
207 } else if (checkBitmapPixels) { 207 } else if (checkBitmapPixels) {
208 REPORTER_ASSERT(reporter, get_dst_bmp_init_color(bx, by, bw) == *pixel); 208 uint32_t origDstPixel = get_dst_bmp_init_color(bx, by, bw);
209 if (get_dst_bmp_init_color(bx, by, bw) != *pixel) { 209 if (origDstPixel != *pixel) {
210 ERRORF(reporter, "Expected clipped out area of readback to b e unchanged. "
211 "Expected 0x%08x, got 0x%08x", origDstPixel, *pixel);
210 return false; 212 return false;
211 } 213 }
212 } 214 }
213 } 215 }
214 } 216 }
215 return true; 217 return true;
216 } 218 }
217 219
218 enum BitmapInit { 220 enum BitmapInit {
219 kFirstBitmapInit = 0, 221 kFirstBitmapInit = 0,
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 check_read(reporter, wkbmp, clippedRect.fLeft, 433 check_read(reporter, wkbmp, clippedRect.fLeft,
432 clippedRect.fTop, true, false); 434 clippedRect.fTop, true, false);
433 } else { 435 } else {
434 REPORTER_ASSERT(reporter, !success); 436 REPORTER_ASSERT(reporter, !success);
435 } 437 }
436 } 438 }
437 } 439 }
438 } 440 }
439 } 441 }
440 } 442 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698