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

Side by Side Diff: tests/ReadPixelsTest.cpp

Issue 2177063002: lockPixelsAreWritable is deprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update test Created 4 years, 4 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/core/SkBitmapDevice.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 static void fill_src_texture(GrTexture* texture) { 123 static void fill_src_texture(GrTexture* texture) {
124 SkBitmap bmp = make_src_bitmap(); 124 SkBitmap bmp = make_src_bitmap();
125 bmp.lockPixels(); 125 bmp.lockPixels();
126 texture->writePixels(0, 0, DEV_W, DEV_H, kSkia8888_GrPixelConfig, bmp.getPix els(), 126 texture->writePixels(0, 0, DEV_W, DEV_H, kSkia8888_GrPixelConfig, bmp.getPix els(),
127 bmp.rowBytes()); 127 bmp.rowBytes());
128 bmp.unlockPixels(); 128 bmp.unlockPixels();
129 } 129 }
130 #endif 130 #endif
131 131
132 static void fill_dst_bmp_with_init_data(SkBitmap* bitmap) { 132 static void fill_dst_bmp_with_init_data(SkBitmap* bitmap) {
133 SkASSERT(bitmap->lockPixelsAreWritable());
134 SkAutoLockPixels alp(*bitmap); 133 SkAutoLockPixels alp(*bitmap);
135 int w = bitmap->width(); 134 int w = bitmap->width();
136 int h = bitmap->height(); 135 int h = bitmap->height();
137 intptr_t pixels = reinterpret_cast<intptr_t>(bitmap->getPixels()); 136 intptr_t pixels = reinterpret_cast<intptr_t>(bitmap->getPixels());
138 for (int y = 0; y < h; ++y) { 137 for (int y = 0; y < h; ++y) {
139 for (int x = 0; x < w; ++x) { 138 for (int x = 0; x < w; ++x) {
140 SkPMColor* pixel = reinterpret_cast<SkPMColor*>(pixels + y * bitmap- >rowBytes() + x * bitmap->bytesPerPixel()); 139 SkPMColor* pixel = reinterpret_cast<SkPMColor*>(pixels + y * bitmap- >rowBytes() + x * bitmap->bytesPerPixel());
141 *pixel = get_dst_bmp_init_color(x, y, w); 140 *pixel = get_dst_bmp_init_color(x, y, w);
142 } 141 }
143 } 142 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 desc.fHeight = DEV_H; 451 desc.fHeight = DEV_H;
453 desc.fConfig = kSkia8888_GrPixelConfig; 452 desc.fConfig = kSkia8888_GrPixelConfig;
454 desc.fOrigin = origin; 453 desc.fOrigin = origin;
455 desc.fFlags = kNone_GrSurfaceFlags; 454 desc.fFlags = kNone_GrSurfaceFlags;
456 texture.reset(ctxInfo.grContext()->textureProvider()->createTexture(desc , 455 texture.reset(ctxInfo.grContext()->textureProvider()->createTexture(desc ,
457 SkBu dgeted::kNo)); 456 SkBu dgeted::kNo));
458 test_readpixels_texture(reporter, texture); 457 test_readpixels_texture(reporter, texture);
459 } 458 }
460 } 459 }
461 #endif 460 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698