| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "../src/image/SkImagePriv.h" | 8 #include "../src/image/SkImagePriv.h" |
| 9 #include "../src/image/SkSurface_Base.h" | 9 #include "../src/image/SkSurface_Base.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 static SkSurface* createSurface(SkColor color) { | 34 static SkSurface* createSurface(SkColor color) { |
| 35 SkSurface* surface = SkSurface::NewRasterPMColor(gWidth, gHeight); | 35 SkSurface* surface = SkSurface::NewRasterPMColor(gWidth, gHeight); |
| 36 surface->getCanvas()->clear(color); | 36 surface->getCanvas()->clear(color); |
| 37 return surface; | 37 return surface; |
| 38 } | 38 } |
| 39 | 39 |
| 40 static SkPMColor read_pixel(SkSurface* surface, int x, int y) { | 40 static SkPMColor read_pixel(SkSurface* surface, int x, int y) { |
| 41 SkPMColor pixel = 0; | 41 SkPMColor pixel = 0; |
| 42 SkBitmap bitmap; | 42 SkBitmap bitmap; |
| 43 bitmap.installPixels(SkImageInfo::MakeN32Premul(1, 1), &pixel, 4, NULL, NULL
); | 43 bitmap.installPixels(SkImageInfo::MakeN32Premul(1, 1), &pixel, 4); |
| 44 SkCanvas canvas(bitmap); | 44 SkCanvas canvas(bitmap); |
| 45 | 45 |
| 46 SkPaint paint; | 46 SkPaint paint; |
| 47 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 47 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 48 surface->draw(&canvas, -SkIntToScalar(x), -SkIntToScalar(y), &paint); | 48 surface->draw(&canvas, -SkIntToScalar(x), -SkIntToScalar(y), &paint); |
| 49 return pixel; | 49 return pixel; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static void TestDeferredCanvasBitmapAccess(skiatest::Reporter* reporter) { | 52 static void TestDeferredCanvasBitmapAccess(skiatest::Reporter* reporter) { |
| 53 SkBitmap store; | 53 SkBitmap store; |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 TestDeferredCanvasSurface(reporter, NULL); | 831 TestDeferredCanvasSurface(reporter, NULL); |
| 832 TestDeferredCanvasSetSurface(reporter, NULL); | 832 TestDeferredCanvasSetSurface(reporter, NULL); |
| 833 } | 833 } |
| 834 | 834 |
| 835 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { | 835 DEF_GPUTEST(DeferredCanvas_GPU, reporter, factory) { |
| 836 if (factory != NULL) { | 836 if (factory != NULL) { |
| 837 TestDeferredCanvasSurface(reporter, factory); | 837 TestDeferredCanvasSurface(reporter, factory); |
| 838 TestDeferredCanvasSetSurface(reporter, factory); | 838 TestDeferredCanvasSetSurface(reporter, factory); |
| 839 } | 839 } |
| 840 } | 840 } |
| OLD | NEW |