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 "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 Loading... |
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 Loading... |
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 |
OLD | NEW |